From 3c3c0b456e856c9b8b60d6f9d241ef37e9af70b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2013 09:59:59 +0100 Subject: [PATCH 01/37] Fix: _ not allowed into prestashop tags. --- htdocs/admin/sms.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 45bbcaa76e9..de795f4683b 100755 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -161,7 +161,7 @@ if ($action == 'edit') { $form=new Form($db); - if (! count($listofmethods)) print '
'.$langs->trans("NoSmsEngine",'DoliStore').'
'; + if (! count($listofmethods)) print '
'.$langs->trans("NoSmsEngine",'DoliStore').'
'; print '
'; print ''; @@ -217,7 +217,7 @@ else { $var=true; - if (! count($listofmethods)) print '
'.$langs->trans("NoSmsEngine",'DoliStore').'
'; + if (! count($listofmethods)) print '
'.$langs->trans("NoSmsEngine",'DoliStore').'
'; print ''; print ''; From d5a1f64e760c5232b93a1f232bcc37d1f95feb19 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 29 Mar 2013 02:09:19 +0100 Subject: [PATCH 02/37] Update mysql.class.php some other problems about DDLCreateTable, other field setting not actived --- htdocs/core/db/mysql.class.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 1143372bb98..4868fb81642 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -886,21 +886,23 @@ class DoliDBMysql $sqlfields[$i] = $field_name." "; $sqlfields[$i] .= $field_desc['type']; if( preg_match("/^[^\s]/i",$field_desc['value'])) - $sqlfields[$i] .= "(".$field_desc['value'].")"; - else if( preg_match("/^[^\s]/i",$field_desc['attribute'])) - $sqlfields[$i] .= " ".$field_desc['attribute']; - else if( preg_match("/^[^\s]/i",$field_desc['default'])) + $sqlfields[$i] .= "(".$field_desc['value'].")"; + if( preg_match("/^[^\s]/i",$field_desc['attribute'])) + $sqlfields[$i] .= " ".$field_desc['attribute']; + if( preg_match("/^[^\s]/i",$field_desc['default'])) { if(preg_match("/null/i",$field_desc['default'])) - $sqlfields[$i] .= " default ".$field_desc['default']; + $sqlfields[$i] .= " default ".$field_desc['default']; + elseif ($field_desc['default'] == 'CURRENT_TIMESTAMP') + $sqlfields[$i] .= " default ".$field_desc['default']; else - $sqlfields[$i] .= " default '".$field_desc['default']."'"; + $sqlfields[$i] .= " default '".$field_desc['default']."'"; } - else if( preg_match("/^[^\s]/i",$field_desc['null'])) - $sqlfields[$i] .= " ".$field_desc['null']; + if( preg_match("/^[^\s]/i",$field_desc['null'])) + $sqlfields[$i] .= " ".$field_desc['null']; - else if( preg_match("/^[^\s]/i",$field_desc['extra'])) - $sqlfields[$i] .= " ".$field_desc['extra']; + if( preg_match("/^[^\s]/i",$field_desc['extra'])) + $sqlfields[$i] .= " ".$field_desc['extra']; $i++; } if($primary_key != "") From 888da9f3e9f1fa073c4b6cd4e4f1d54b1ccebf9c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 29 Mar 2013 11:52:18 +0100 Subject: [PATCH 03/37] Fix: file with a specific mask not found --- htdocs/comm/propal.php | 3794 ++++++++++++++++++++-------------------- 1 file changed, 1897 insertions(+), 1897 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 1201fbf8835..b6ef6d3f5b8 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1,742 +1,742 @@ - - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2012 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012 Christophe Battarel -* - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/comm/propal.php - * \ingroup propale - * \brief Page of commercial proposals card and list - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - -$langs->load('companies'); -$langs->load('propal'); -$langs->load('compta'); -$langs->load('bills'); -$langs->load('orders'); -$langs->load('products'); -if (! empty($conf->margin->enabled)) - $langs->load('margins'); - -$error=0; - -$id=GETPOST('id','int'); -$ref=GETPOST('ref','alpha'); -$socid=GETPOST('socid','int'); -$action=GETPOST('action','alpha'); -$confirm=GETPOST('confirm','alpha'); -$lineid=GETPOST('lineid','int'); - -//PDF -$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); -$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); -$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); - -// Nombre de ligne pour choix de produit/service predefinis -$NBLINES=4; - -// Security check -if (! empty($user->societe_id)) $socid=$user->societe_id; -$result = restrictedArea($user, 'propal', $id); - -$object = new Propal($db); - -// Load object -if ($id > 0 || ! empty($ref)) -{ - if ($action != 'add') - { - $ret=$object->fetch($id, $ref); - if ($ret == 0) - { - $langs->load("errors"); - setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); - $error++; - } - else if ($ret < 0) - { - setEventMessage($object->error, 'errors'); - $error++; - } - else $object->fetch_thirdparty(); - } -} -else -{ - header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); - exit; -} - -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$hookmanager=new HookManager($db); -$hookmanager->initHooks(array('propalcard')); - - - -/* - * Actions - */ - -$parameters=array('socid'=>$socid); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - -// Action clone object -if ($action == 'confirm_clone' && $confirm == 'yes') -{ - if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) - { - setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); - } - else - { - if ($object->id > 0) - { - $result=$object->createFromClone($socid, $hookmanager); - if ($result > 0) - { - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); - exit; - } - else - { - setEventMessage($object->error, 'errors'); - $action=''; - } - } - } -} - -// Suppression de la propale -else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) -{ - $result=$object->delete($user); - if ($result > 0) - { - header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); - exit; - } - else - { - $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); - } -} - -// Remove line -else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) -{ - $result = $object->deleteline($lineid); - // reorder lines - if ($result) $object->line_order(true); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; -} - -// Validation -else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) -{ - $result=$object->valid($user); - if ($result >= 0) - { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - } - else - { - $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); - } -} - -else if ($action == 'setdate' && $user->rights->propal->creer) -{ - $datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - - if (empty($datep)) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); - } - - if (! $error) - { - $result=$object->set_date($user,$datep); - if ($result < 0) dol_print_error($db,$object->error); - } -} -else if ($action == 'setecheance' && $user->rights->propal->creer) -{ - $result=$object->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); - if ($result < 0) dol_print_error($db,$object->error); -} -else if ($action == 'setdate_livraison' && $user->rights->propal->creer) -{ - $result=$object->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); - if ($result < 0) dol_print_error($db,$object->error); -} - -// Positionne ref client -else if ($action == 'set_ref_client' && $user->rights->propal->creer) -{ - $object->set_ref_client($user, $_POST['ref_client']); -} - -else if ($action == 'setnote_public' && $user->rights->propal->creer) -{ - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); - if ($result < 0) dol_print_error($db,$object->error); -} - -else if ($action == 'setnote' && $user->rights->propal->creer) -{ - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); - if ($result < 0) dol_print_error($db,$object->error); -} - -// Create proposal -else if ($action == 'add' && $user->rights->propal->creer) -{ - $object->socid=$socid; - $object->fetch_thirdparty(); - - $datep=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - $date_delivery=dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); - $duration=GETPOST('duree_validite'); - - if (empty($datep)) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); - header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); - exit; - } - if (empty($duration)) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors'); - header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); - exit; - } - - if (! $error) - { - $db->begin(); - - // Si on a selectionne une propal a copier, on realise la copie - if (GETPOST('createmode')=='copy' && GETPOST('copie_propal')) - { - if ($object->fetch(GETPOST('copie_propal')) > 0) - { - $object->ref = GETPOST('ref'); - $object->datep = $datep; - $object->date_livraison = $date_delivery; - $object->availability_id = GETPOST('availability_id'); - $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->fk_delivery_address = GETPOST('fk_address'); - $object->duree_validite = $duration; - $object->cond_reglement_id = GETPOST('cond_reglement_id'); - $object->mode_reglement_id = GETPOST('mode_reglement_id'); - $object->remise_percent = GETPOST('remise_percent'); - $object->remise_absolue = GETPOST('remise_absolue'); - $object->socid = GETPOST('socid'); - $object->contactid = GETPOST('contactidp'); - $object->fk_project = GETPOST('projectid'); - $object->modelpdf = GETPOST('model'); - $object->author = $user->id; // deprecated - $object->note = GETPOST('note'); - $object->statut = 0; - - $id = $object->create_from($user); - } - else - { - setEventMessage($langs->trans("ErrorFailedToCopyProposal",GETPOST('copie_propal')), 'errors'); - } - } - else - { - $object->ref = GETPOST('ref'); - $object->ref_client = GETPOST('ref_client'); - $object->datep = $datep; - $object->date_livraison = $date_delivery; - $object->availability_id = GETPOST('availability_id'); - $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->fk_delivery_address = GETPOST('fk_address'); - $object->duree_validite = GETPOST('duree_validite'); - $object->cond_reglement_id = GETPOST('cond_reglement_id'); - $object->mode_reglement_id = GETPOST('mode_reglement_id'); - - $object->contactid = GETPOST('contactidp'); - $object->fk_project = GETPOST('projectid'); - $object->modelpdf = GETPOST('model'); - $object->author = $user->id; // deprecated - $object->note = GETPOST('note'); - - $object->origin = GETPOST('origin'); - $object->origin_id = GETPOST('originid'); - - for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) - { - if ($_POST['idprod'.$i]) - { - $xid = 'idprod'.$i; - $xqty = 'qty'.$i; - $xremise = 'remise'.$i; - $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); - } - } - - $id = $object->create($user); - } - - if ($id > 0) - { - // Insertion contact par defaut si defini - if (GETPOST('contactidp')) - { - $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); - if ($result < 0) - { - $error++; - setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); - } - } - - if (! $error) - { - $db->commit(); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); - exit; - } - else - { - $db->rollback(); - } - } - else - { - dol_print_error($db,$object->error); - $db->rollback(); - exit; - } - } -} - -// Classify billed -else if ($action == 'classifybilled' && $user->rights->propal->cloturer) -{ - $object->cloture($user, 4, ''); -} - -// Reopen proposal -else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) -{ - // prevent browser refresh from reopening proposal several times - if ($object->statut==2 || $object->statut==3) - { - $object->setStatut(1); - } -} - -// Close proposal -else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) -{ - if (! GETPOST('statut')) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")), 'errors'); - $action='statut'; - } - else - { - // prevent browser refresh from closing proposal several times - if ($object->statut==1) - { - $object->cloture($user, GETPOST('statut'), GETPOST('note')); - } - } -} - -/* - * Add file in email form - */ -if (GETPOST('addfile')) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - dol_add_file_process($upload_dir_tmp,0,0); - $action='presend'; -} - -/* - * Remove file in email form - */ -if (GETPOST('removedfile')) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir=$conf->user->dir_output."/".$user->id; - $upload_dir_tmp = $vardir.'/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST['removedfile'],0); - $action='presend'; -} - -/* - * Send mail - */ -if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) -{ - $langs->load('mails'); - - if ($object->id > 0) - { - if ($_POST['sendto']) - { - // Le destinataire a ete fourni via le champ libre - $sendto = $_POST['sendto']; - $sendtoid = 0; - } - elseif ($_POST['receiver'] != '-1') - { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $object->client->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $object->client->contact_get_property($_POST['receiver'],'email'); - $sendtoid = $_POST['receiver']; - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; - $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $deliveryreceipt = $_POST['deliveryreceipt']; - - if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; - else $subject = $langs->transnoentities('Propal').' '.$object->ref; - $actiontypecode='AC_PROP'; - $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; - if ($message) - { - $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; - $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; - $actionmsg.=$message; - } - $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles=$formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Envoi de la propal - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); - if ($mailfile->error) - { - setEventMessage($mailfile->error, 'errors'); - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('PROPAL_SENTBYMAIL',$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers - - if (! $error) - { - // Redirect here - // This avoid sending mail twice if going out and then back to page - $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); - setEventMessage($mesg); - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - else - { - dol_print_error($db); - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - setEventMessage($mesg, 'errors'); - } - } - } - else - { - $langs->load("other"); - setEventMessage($langs->trans('ErrorMailRecipientIsEmpty').'!', 'errors'); - dol_syslog($langs->trans('ErrorMailRecipientIsEmpty')); - } - } - else - { - $langs->load("other"); - setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal")), 'errors'); - dol_syslog($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal"))); - } -} - -// Go back to draft -if ($action == 'modif' && $user->rights->propal->creer) -{ - $object->set_draft($user); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } -} - -else if ($action == "setabsolutediscount" && $user->rights->propal->creer) -{ - if ($_POST["remise_id"]) - { - if ($object->id > 0) - { - $result=$object->insert_discount($_POST["remise_id"]); - if ($result < 0) - { - setEventMessage($object->error, 'errors'); - } - } - } -} - -//Ajout d'une ligne produit dans la propale -else if ($action == "addline" && $user->rights->propal->creer) -{ - $idprod=GETPOST('idprod', 'int'); - $product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):''))); - $price_ht = GETPOST('price_ht'); - $tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); - - if (empty($idprod) && GETPOST('type') < 0) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); - $error++; - } - if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht != 0) || $price_ht == '')) // Unit price can be 0 but not ''. Also price can be negative for proposal. - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); - $error++; - } - if (empty($idprod) && empty($product_desc)) - { - setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors'); - $error++; - } - - if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) - { - $pu_ht=0; - $pu_ttc=0; - $price_min=0; - $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); - - // Ecrase $pu par celui du produit - // Ecrase $desc par celui du produit - // Ecrase $txtva par celui du produit - if (! empty($idprod)) - { - $prod = new Product($db); - $prod->fetch($idprod); - - $label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):''); - - // If prices fields are update - if (GETPOST('usenewaddlineform')) - { - $pu_ht=price2num($price_ht, 'MU'); - $pu_ttc=price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr=(preg_match('/\*/', $tva_tx)?1:0); - $tva_tx=str_replace('*','', $tva_tx); - $desc = $product_desc; - } - else - { - $tva_tx = get_default_tva($mysoc,$object->client,$prod->id); - $tva_npr = get_default_npr($mysoc,$object->client,$prod->id); - - // On defini prix unitaire - if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) - { - $pu_ht = $prod->multiprices[$object->client->price_level]; - $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; - $price_min = $prod->multiprices_min[$object->client->price_level]; - $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; - } - else - { - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; - } - - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); - } - } - - $desc=''; - - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); - if (empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; - } - else - { - $desc = $prod->description; - } - - $desc=dol_concatdesc($desc,$product_desc); - + + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2012 Christophe Battarel +* + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/comm/propal.php + * \ingroup propale + * \brief Page of commercial proposals card and list + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + +$langs->load('companies'); +$langs->load('propal'); +$langs->load('compta'); +$langs->load('bills'); +$langs->load('orders'); +$langs->load('products'); +if (! empty($conf->margin->enabled)) + $langs->load('margins'); + +$error=0; + +$id=GETPOST('id','int'); +$ref=GETPOST('ref','alpha'); +$socid=GETPOST('socid','int'); +$action=GETPOST('action','alpha'); +$confirm=GETPOST('confirm','alpha'); +$lineid=GETPOST('lineid','int'); + +//PDF +$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); +$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); +$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); + +// Nombre de ligne pour choix de produit/service predefinis +$NBLINES=4; + +// Security check +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result = restrictedArea($user, 'propal', $id); + +$object = new Propal($db); + +// Load object +if ($id > 0 || ! empty($ref)) +{ + if ($action != 'add') + { + $ret=$object->fetch($id, $ref); + if ($ret == 0) + { + $langs->load("errors"); + setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); + $error++; + } + else if ($ret < 0) + { + setEventMessage($object->error, 'errors'); + $error++; + } + else $object->fetch_thirdparty(); + } +} +else +{ + header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); + exit; +} + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +$hookmanager=new HookManager($db); +$hookmanager->initHooks(array('propalcard')); + + + +/* + * Actions + */ + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + +// Action clone object +if ($action == 'confirm_clone' && $confirm == 'yes') +{ + if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); + } + else + { + if ($object->id > 0) + { + $result=$object->createFromClone($socid, $hookmanager); + if ($result > 0) + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + exit; + } + else + { + setEventMessage($object->error, 'errors'); + $action=''; + } + } + } +} + +// Suppression de la propale +else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) +{ + $result=$object->delete($user); + if ($result > 0) + { + header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); + exit; + } + else + { + $langs->load("errors"); + setEventMessage($langs->trans($object->error), 'errors'); + } +} + +// Remove line +else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) +{ + $result = $object->deleteline($lineid); + // reorder lines + if ($result) $object->line_order(true); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; +} + +// Validation +else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) +{ + $result=$object->valid($user); + if ($result >= 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + } + else + { + $langs->load("errors"); + setEventMessage($langs->trans($object->error), 'errors'); + } +} + +else if ($action == 'setdate' && $user->rights->propal->creer) +{ + $datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + + if (empty($datep)) + { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); + } + + if (! $error) + { + $result=$object->set_date($user,$datep); + if ($result < 0) dol_print_error($db,$object->error); + } +} +else if ($action == 'setecheance' && $user->rights->propal->creer) +{ + $result=$object->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); + if ($result < 0) dol_print_error($db,$object->error); +} +else if ($action == 'setdate_livraison' && $user->rights->propal->creer) +{ + $result=$object->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + if ($result < 0) dol_print_error($db,$object->error); +} + +// Positionne ref client +else if ($action == 'set_ref_client' && $user->rights->propal->creer) +{ + $object->set_ref_client($user, $_POST['ref_client']); +} + +else if ($action == 'setnote_public' && $user->rights->propal->creer) +{ + $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); +} + +else if ($action == 'setnote' && $user->rights->propal->creer) +{ + $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); +} + +// Create proposal +else if ($action == 'add' && $user->rights->propal->creer) +{ + $object->socid=$socid; + $object->fetch_thirdparty(); + + $datep=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $date_delivery=dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); + $duration=GETPOST('duree_validite'); + + if (empty($datep)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); + header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); + exit; + } + if (empty($duration)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors'); + header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); + exit; + } + + if (! $error) + { + $db->begin(); + + // Si on a selectionne une propal a copier, on realise la copie + if (GETPOST('createmode')=='copy' && GETPOST('copie_propal')) + { + if ($object->fetch(GETPOST('copie_propal')) > 0) + { + $object->ref = GETPOST('ref'); + $object->datep = $datep; + $object->date_livraison = $date_delivery; + $object->availability_id = GETPOST('availability_id'); + $object->demand_reason_id = GETPOST('demand_reason_id'); + $object->fk_delivery_address = GETPOST('fk_address'); + $object->duree_validite = $duration; + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->remise_percent = GETPOST('remise_percent'); + $object->remise_absolue = GETPOST('remise_absolue'); + $object->socid = GETPOST('socid'); + $object->contactid = GETPOST('contactidp'); + $object->fk_project = GETPOST('projectid'); + $object->modelpdf = GETPOST('model'); + $object->author = $user->id; // deprecated + $object->note = GETPOST('note'); + $object->statut = 0; + + $id = $object->create_from($user); + } + else + { + setEventMessage($langs->trans("ErrorFailedToCopyProposal",GETPOST('copie_propal')), 'errors'); + } + } + else + { + $object->ref = GETPOST('ref'); + $object->ref_client = GETPOST('ref_client'); + $object->datep = $datep; + $object->date_livraison = $date_delivery; + $object->availability_id = GETPOST('availability_id'); + $object->demand_reason_id = GETPOST('demand_reason_id'); + $object->fk_delivery_address = GETPOST('fk_address'); + $object->duree_validite = GETPOST('duree_validite'); + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + + $object->contactid = GETPOST('contactidp'); + $object->fk_project = GETPOST('projectid'); + $object->modelpdf = GETPOST('model'); + $object->author = $user->id; // deprecated + $object->note = GETPOST('note'); + + $object->origin = GETPOST('origin'); + $object->origin_id = GETPOST('originid'); + + for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) + { + if ($_POST['idprod'.$i]) + { + $xid = 'idprod'.$i; + $xqty = 'qty'.$i; + $xremise = 'remise'.$i; + $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); + } + } + + $id = $object->create($user); + } + + if ($id > 0) + { + // Insertion contact par defaut si defini + if (GETPOST('contactidp')) + { + $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); + if ($result < 0) + { + $error++; + setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); + } + } + + if (! $error) + { + $db->commit(); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + exit; + } + else + { + $db->rollback(); + } + } + else + { + dol_print_error($db,$object->error); + $db->rollback(); + exit; + } + } +} + +// Classify billed +else if ($action == 'classifybilled' && $user->rights->propal->cloturer) +{ + $object->cloture($user, 4, ''); +} + +// Reopen proposal +else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) +{ + // prevent browser refresh from reopening proposal several times + if ($object->statut==2 || $object->statut==3) + { + $object->setStatut(1); + } +} + +// Close proposal +else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) +{ + if (! GETPOST('statut')) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")), 'errors'); + $action='statut'; + } + else + { + // prevent browser refresh from closing proposal several times + if ($object->statut==1) + { + $object->cloture($user, GETPOST('statut'), GETPOST('note')); + } + } +} + +/* + * Add file in email form + */ +if (GETPOST('addfile')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory TODO Use a dedicated directory for temp mails files + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + dol_add_file_process($upload_dir_tmp,0,0); + $action='presend'; +} + +/* + * Remove file in email form + */ +if (GETPOST('removedfile')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + // TODO Delete only files that was uploaded from email form + dol_remove_file_process($_POST['removedfile'],0); + $action='presend'; +} + +/* + * Send mail + */ +if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) +{ + $langs->load('mails'); + + if ($object->id > 0) + { + if ($_POST['sendto']) + { + // Le destinataire a ete fourni via le champ libre + $sendto = $_POST['sendto']; + $sendtoid = 0; + } + elseif ($_POST['receiver'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receiver'] == 'thirdparty') // Id of third party + { + $sendto = $object->client->email; + $sendtoid = 0; + } + else // Id du contact + { + $sendto = $object->client->contact_get_property($_POST['receiver'],'email'); + $sendtoid = $_POST['receiver']; + } + } + + if (dol_strlen($sendto)) + { + $langs->load("commercial"); + + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; + $message = $_POST['message']; + $sendtocc = $_POST['sendtocc']; + $deliveryreceipt = $_POST['deliveryreceipt']; + + if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; + else $subject = $langs->transnoentities('Propal').' '.$object->ref; + $actiontypecode='AC_PROP'; + $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + if ($message) + { + $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; + $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; + $actionmsg.=$message; + } + $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + $attachedfiles=$formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + // Envoi de la propal + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); + if ($mailfile->error) + { + setEventMessage($mailfile->error, 'errors'); + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + // Initialisation donnees + $object->sendtoid = $sendtoid; + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; + $object->actionmsg2 = $actionmsg2; + $object->fk_element = $object->id; + $object->elementtype = $object->element; + + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('PROPAL_SENTBYMAIL',$object,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + + if (! $error) + { + // Redirect here + // This avoid sending mail twice if going out and then back to page + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); + setEventMessage($mesg); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + dol_print_error($db); + } + } + else + { + $langs->load("other"); + if ($mailfile->error) + { + $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.='
'.$mailfile->error; + } + else + { + $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; + } + setEventMessage($mesg, 'errors'); + } + } + } + else + { + $langs->load("other"); + setEventMessage($langs->trans('ErrorMailRecipientIsEmpty').'!', 'errors'); + dol_syslog($langs->trans('ErrorMailRecipientIsEmpty')); + } + } + else + { + $langs->load("other"); + setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal")), 'errors'); + dol_syslog($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal"))); + } +} + +// Go back to draft +if ($action == 'modif' && $user->rights->propal->creer) +{ + $object->set_draft($user); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } +} + +else if ($action == "setabsolutediscount" && $user->rights->propal->creer) +{ + if ($_POST["remise_id"]) + { + if ($object->id > 0) + { + $result=$object->insert_discount($_POST["remise_id"]); + if ($result < 0) + { + setEventMessage($object->error, 'errors'); + } + } + } +} + +//Ajout d'une ligne produit dans la propale +else if ($action == "addline" && $user->rights->propal->creer) +{ + $idprod=GETPOST('idprod', 'int'); + $product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):''))); + $price_ht = GETPOST('price_ht'); + $tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); + + if (empty($idprod) && GETPOST('type') < 0) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); + $error++; + } + if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht != 0) || $price_ht == '')) // Unit price can be 0 but not ''. Also price can be negative for proposal. + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); + $error++; + } + if (empty($idprod) && empty($product_desc)) + { + setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors'); + $error++; + } + + if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) + { + $pu_ht=0; + $pu_ttc=0; + $price_min=0; + $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); + + // Ecrase $pu par celui du produit + // Ecrase $desc par celui du produit + // Ecrase $txtva par celui du produit + if (! empty($idprod)) + { + $prod = new Product($db); + $prod->fetch($idprod); + + $label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):''); + + // If prices fields are update + if (GETPOST('usenewaddlineform')) + { + $pu_ht=price2num($price_ht, 'MU'); + $pu_ttc=price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr=(preg_match('/\*/', $tva_tx)?1:0); + $tva_tx=str_replace('*','', $tva_tx); + $desc = $product_desc; + } + else + { + $tva_tx = get_default_tva($mysoc,$object->client,$prod->id); + $tva_npr = get_default_npr($mysoc,$object->client,$prod->id); + + // On defini prix unitaire + if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) + { + $pu_ht = $prod->multiprices[$object->client->price_level]; + $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; + $price_min = $prod->multiprices_min[$object->client->price_level]; + $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; + } + else + { + $pu_ht = $prod->price; + $pu_ttc = $prod->price_ttc; + $price_min = $prod->price_min; + $price_base_type = $prod->price_base_type; + } + + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + if ($tva_tx != $prod->tva_tx) + { + if ($price_base_type != 'HT') + { + $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + } + + $desc=''; + + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); + if (empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; + } + else + { + $desc = $prod->description; + } + + $desc=dol_concatdesc($desc,$product_desc); + // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { @@ -747,1161 +747,1161 @@ else if ($action == "addline" && $user->rights->propal->creer) $tmptxt.=')'; $desc= dol_concatdesc($desc, $tmptxt); } - } - - $type = $prod->type; - } - else - { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr = (preg_match('/\*/', $tva_tx)?1:0); - $tva_tx = str_replace('*', '', $tva_tx); - $label = (GETPOST('product_label')?GETPOST('product_label'):''); - $desc = $product_desc; - $type = GETPOST('type'); - } - - // Margin - $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); - $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); - - // Local Taxes - $localtax1_tx= get_localtax($tva_tx, 1, $object->client); - $localtax2_tx= get_localtax($tva_tx, 2, $object->client); - - $info_bits=0; - if ($tva_npr) $info_bits |= 0x01; - - if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) - { - $mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').getCurrencySymbol($conf->currency)); - setEventMessage($mesg, 'errors'); - } - else - { - // Insert line - $result=$object->addline( - $id, - $desc, - $pu_ht, - GETPOST('qty'), - $tva_tx, - $localtax1_tx, - $localtax2_tx, - $idprod, - GETPOST('remise_percent'), - $price_base_type, - $pu_ttc, - $info_bits, - $type, - -1, - 0, - GETPOST('fk_parent_line'), - $fournprice, - $buyingprice, - $label - ); - - if ($result > 0) - { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['idprod']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - - // old method - unset($_POST['np_desc']); - unset($_POST['dp_desc']); - } - else - { - setEventMessage($object->error, 'errors'); - } - } - } -} - -// Mise a jour d'une ligne dans la propale -else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) -{ - // Define info_bits - $info_bits=0; - if (preg_match('/\*/', GETPOST('tva_tx'))) $info_bits |= 0x01; - - // Clean parameters - $description=dol_htmlcleanlastbr(GETPOST('product_desc')); - - // Define vat_rate - $vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); - $vat_rate=str_replace('*','',$vat_rate); - $localtax1_rate=get_localtax($vat_rate,1,$object->client); - $localtax2_rate=get_localtax($vat_rate,2,$object->client); - $pu_ht=GETPOST('price_ht'); - - // Add buying price - $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); - $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); - - // Define special_code for special lines - $special_code=0; - if (! GETPOST('qty')) $special_code=3; - - // Check minimum price - $productid = GETPOST('productid', 'int'); - if (! empty($productid)) - { - $product = new Product($db); - $res=$product->fetch($productid); - - $type=$product->type; - - $price_min = $product->price_min; - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) - $price_min = $product->multiprices_min[$object->client->price_level]; - - $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); - - if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) - { - setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors'); - $error++; - } - } - else - { - $type = GETPOST('type'); - $label = (GETPOST('product_label') ? GETPOST('product_label'):''); - - // Check parameters - if (GETPOST('type') < 0) { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); - $error++; - } - } - - if (! $error) - { - $result = $object->updateline( - GETPOST('lineid'), - $pu_ht, - GETPOST('qty'), - GETPOST('remise_percent'), - $vat_rate, - $localtax1_rate, - $localtax2_rate, - $description, - 'HT', - $info_bits, - $special_code, - GETPOST('fk_parent_line'), - 0, - $fournprice, - $buyingprice, - $label, - $type - ); - - if ($result >= 0) - { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['productid']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - } - else - { - setEventMessage($object->error, 'errors'); - } - } -} - -else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) -{ - header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition - exit; -} - -// Generation doc (depuis lien ou depuis cartouche doc) -else if ($action == 'builddoc' && $user->rights->propal->creer) -{ - if (GETPOST('model')) - { - $object->setDocModel($user, GETPOST('model')); - } - - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - $result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } -} - -// Remove file in doc form -else if ($action == 'remove_file' && $user->rights->propal->creer) -{ - if ($object->id > 0) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - $langs->load("other"); - $upload_dir = $conf->propal->dir_output; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); - } -} - -// Set project -else if ($action == 'classin' && $user->rights->propal->creer) -{ - $object->setProject($_POST['projectid']); -} - -// Delai de livraison -else if ($action == 'setavailability' && $user->rights->propal->creer) -{ - $result = $object->availability($_POST['availability_id']); -} - -// Origine de la propale -else if ($action == 'setdemandreason' && $user->rights->propal->creer) -{ - $result = $object->demand_reason($_POST['demand_reason_id']); -} - -// Conditions de reglement -else if ($action == 'setconditions' && $user->rights->propal->creer) -{ - $result = $object->setPaymentTerms(GETPOST('cond_reglement_id','int')); -} - -else if ($action == 'setremisepercent' && $user->rights->propal->creer) -{ - $result = $object->set_remise_percent($user, $_POST['remise_percent']); -} - -else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) -{ - $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); -} - -// Mode de reglement -else if ($action == 'setmode' && $user->rights->propal->creer) -{ - $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); -} - -/* - * Ordonnancement des lignes - */ - -else if ($action == 'up' && $user->rights->propal->creer) -{ - $object->line_up(GETPOST('rowid')); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); - exit; -} - -else if ($action == 'down' && $user->rights->propal->creer) -{ - $object->line_down(GETPOST('rowid')); - - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $outputlangs = new Translate("",$conf); - $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); - $outputlangs->setDefaultLang($newlang); - } - $ret=$object->fetch($id); // Reload to get new records - propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); - exit; -} - -if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) -{ - if ($action == 'addcontact') - { - if ($object->id > 0) - { - $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); - } - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { - $langs->load("errors"); - setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); - } - else - { - setEventMessage($object->error, 'errors'); - } - } - } - - // Bascule du statut d'un contact - else if ($action == 'swapstatut') - { - if ($object->fetch($id) > 0) - { - $result=$object->swapContactStatus(GETPOST('ligne')); - } - else - { - dol_print_error($db); - } - } - - // Efface un contact - else if ($action == 'deletecontact') - { - $object->fetch($id); - $result = $object->delete_contact($lineid); - - if ($result >= 0) - { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - dol_print_error($db); - } - } -} - - -/* - * View - */ - -llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); - -$form = new Form($db); -$formother = new FormOther($db); -$formfile = new FormFile($db); -$formpropal = new FormPropal($db); -$companystatic=new Societe($db); - -$now=dol_now(); - -/* - * Show object in view mode - */ - -$soc = new Societe($db); -$soc->fetch($object->socid); - -$head = propal_prepare_head($object); -dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); - -$formconfirm=''; - -// Clone confirmation -if ($action == 'clone') -{ - // Create an array for form - $formquestion=array( - //'text' => $langs->trans("ConfirmClone"), - //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid','int'),'socid','(s.client=1 OR s.client=2 OR s.client=3)')) - ); - // Paiement incomplet. On demande si motif = escompte ou autre - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1); -} - -// Confirm delete -else if ($action == 'delete') -{ - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1); -} - -// Confirm reopen -else if ($action == 'reopen') -{ - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1); -} - -// Confirmation delete product/service line -else if ($action == 'ask_deleteline') -{ - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1); -} - -// Confirm validate proposal -else if ($action == 'validate') -{ - $error=0; - - // on verifie si l'objet est en numerotation provisoire - $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') - { - $numref = $object->getNextNumRef($soc); - if (empty($numref)) - { - $error++; - dol_htmloutput_errors($object->error); - } - } - else - { - $numref = $object->ref; - } - - $text=$langs->trans('ConfirmValidateProp',$numref); - if (! empty($conf->notification->enabled)) - { - require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; - $notify=new Notify($db); - $text.='
'; - $text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid); - } - - if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1); -} - -if (! $formconfirm) -{ - $parameters=array('lineid'=>$lineid); - $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook -} - -// Print form confirm -print $formconfirm; - - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - -$linkback = ''.$langs->trans("BackToList").''; - -// Ref -print ''; - -// Ref client -print ''; -print ''; - -// Company -print ''; -print ''; - -// Ligne info remises tiers -print ''; - -// Date of proposal -print ''; -print ''; - -// Date end proposal -print ''; -print ''; -print ''; - -// Payment term -print ''; -print ''; - -// Delivery date -$langs->load('deliveries'); -print ''; -print ''; - -// Delivery delay -print ''; -print ''; - -// Origin of demand -print ''; -print ''; - -// Payment mode -print ''; -print ''; - -// Project -if (! empty($conf->projet->enabled)) -{ - $langs->load("projects"); - print ''; - } - else - { - print '
'.$langs->trans('Ref').''; -print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); -print '
'; -print ''; -if ($action != 'refclient' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('RefCustomer').''; -print ''.img_edit($langs->trans('Modify')).'
'; -print '
'; -if ($user->rights->propal->creer && $action == 'refclient') -{ - print ''; - print ''; - print ''; - print ''; - print ' '; - print ''; -} -else -{ - print $object->ref_client; -} -print '
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans('Discounts').''; -if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); -else print $langs->trans("CompanyHasNoRelativeDiscount"); -print '. '; -$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); -$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); -$absolute_discount=price2num($absolute_discount,'MT'); -$absolute_creditnote=price2num($absolute_creditnote,'MT'); -if ($absolute_discount) -{ - if ($object->statut > 0) - { - print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - } - else - { - // Remise dispo de type non avoir - $filter='fk_facture_source IS NULL'; - print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter); - } -} -if ($absolute_creditnote) -{ - print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'. '; -} -if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; -print '
'; -print ''; -if ($action != 'editdate' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('Date'); -print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; -print '
'; -if (! empty($object->brouillon) && $action == 'editdate') -{ - print '
'; - print ''; - print ''; - $form->select_date($object->date,'re','','',0,"editdate"); - print ''; - print '
'; -} -else -{ - if ($object->date) - { - print dol_print_date($object->date,'daytext'); - } - else - { - print ' '; - } -} -print '
'; -print ''; -if ($action != 'editecheance' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('DateEndPropal'); -print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; -print '
'; -if (! empty($object->brouillon) && $action == 'editecheance') -{ - print '
'; - print ''; - print ''; - $form->select_date($object->fin_validite,'ech','','','',"editecheance"); - print ''; - print '
'; -} -else -{ - if (! empty($object->fin_validite)) - { - print dol_print_date($object->fin_validite,'daytext'); - if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); - } - else - { - print ' '; - } -} -print '
'; -print ''; -if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('PaymentConditionsShort'); -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'
'; -print '
'; -if ($action == 'editconditions') -{ - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); -} -else -{ - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); -} -print '
'; -print ''; -if ($action != 'editdate_livraison' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('DeliveryDate'); -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'
'; -print '
'; -if ($action == 'editdate_livraison') -{ - print '
'; - print ''; - print ''; - $form->select_date($object->date_livraison,'liv_','','','',"editdate_livraison"); - print ''; - print '
'; -} -else -{ - print dol_print_date($object->date_livraison,'daytext'); -} -print '
'; -print ''; -if ($action != 'editavailability' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('AvailabilityPeriod'); -if (! empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')'; -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'
'; -print '
'; -if ($action == 'editavailability') -{ - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'availability_id',1); -} -else -{ - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1); -} - -print '
'; -print ''; -if ($action != 'editdemandreason' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('Source'); -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'
'; -print '
'; -//print $object->demand_reason_id; -if ($action == 'editdemandreason') -{ - $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); -} -else -{ - $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none'); -} - -print '
'; -print ''; -if ($action != 'editmode' && ! empty($object->brouillon)) print ''; -print '
'; -print $langs->trans('PaymentMode'); -print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'
'; -print '
'; -if ($action == 'editmode') -{ - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); -} -else -{ - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); -} -print '
'; - print ''; - if ($user->rights->propal->creer) - { - if ($action != 'classify') print ''; - print '
'; - print $langs->trans('Project').''.img_edit($langs->transnoentitiesnoconv('SetProject')).'
'; - print '
'; - if ($action == 'classify') - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid'); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none'); - } - print '
'; - if (! empty($object->fk_project)) - { - print ''; - $proj = new Project($db); - $proj->fetch($object->fk_project); - print ''; - print $proj->ref; - print ''; - print ''; - } - else { - print ' '; - } - } - print ''; -} - -// Other attributes -$parameters=array('colspan' => ' colspan="3"'); -$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook -if (empty($reshook) && ! empty($extrafields->attribute_label)) -{ - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } -} - -// Amount HT -print ''.$langs->trans('AmountHT').''; -print ''.price($object->total_ht).''; -print ''.$langs->trans("Currency".$conf->currency).''; - -// Margin Infos -if (! empty($conf->margin->enabled)) { - print ''; - $object->displayMarginInfos(); - print ''; -} -print ''; - -// Amount VAT -print ''.$langs->trans('AmountVAT').''; -print ''.price($object->total_tva).''; -print ''.$langs->trans("Currency".$conf->currency).''; - -// Amount Local Taxes -if ($mysoc->localtax1_assuj=="1") //Localtax1 -{ - print ''.$langs->transcountry("AmountLT1",$mysoc->country_code).''; - print ''.price($object->total_localtax1).''; - print ''.$langs->trans("Currency".$conf->currency).''; -} -if ($mysoc->localtax2_assuj=="1") //Localtax2 -{ - print ''.$langs->transcountry("AmountLT2",$mysoc->country_code).''; - print ''.price($object->total_localtax2).''; - print ''.$langs->trans("Currency".$conf->currency).''; -} - - -// Amount TTC -print ''.$langs->trans('AmountTTC').''; -print ''.price($object->total_ttc).''; -print ''.$langs->trans("Currency".$conf->currency).''; - -// Statut -print ''.$langs->trans('Status').''.$object->getLibStatut(4).''; - -print '
'; - -if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) -{ - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; -} - -if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) -{ - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; -} - -/* - * Lines - */ - -if (! empty($conf->use_javascript_ajax) && $object->statut == 0) -{ - include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; -} - -print ''; - -// Show object lines -$result = $object->getLinesArray(); -if (! empty($object->lines)) - $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager); - -// Form to add new line -if ($object->statut == 0 && $user->rights->propal->creer) -{ - if ($action != 'editline') - { - $var=true; - - if ($conf->global->MAIN_FEATURES_LEVEL > 1) - { - // Add free or predefined products/services - $object->formAddObjectLine(0,$mysoc,$soc,$hookmanager); - } - else - { - // Add free products/services - $object->formAddFreeProduct(0,$mysoc,$soc,$hookmanager); - - // Add predefined products/services - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) - { - $var=!$var; - $object->formAddPredefinedProduct(0,$mysoc,$soc,$hookmanager); - } - } - - $parameters=array(); - $reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - } -} - -print '
'; - -print ''; -print "\n"; - -if ($action == 'statut') -{ - /* - * Formulaire cloture (signe ou non) - */ - $form_close = '
'; - $form_close.= ''; - $form_close.= ''; - $form_close.= ''; - $form_close.= ''; - $form_close.= ''; - $form_close.= '
'.$langs->trans("CloseAs").''; - $form_close.= ''; - $form_close.= ''; - $form_close.= '
'.$langs->trans('Note').'
'; - $form_close.= ''; - $form_close.= '   '; - $form_close.= ' '; - $form_close.= '
'; - - print $form_close; -} - - -/* - * Boutons Actions - */ -if ($action != 'presend') -{ - print '
'; - - if ($action != 'statut' && $action <> 'editline') - { - // Validate - if ($object->statut == 0 && $user->rights->propal->valider) - { - if (count($object->lines) > 0) print ''.$langs->trans('Validate').''; - else print ''.$langs->trans('Validate').''; - } - - // Edit - if ($object->statut == 1 && $user->rights->propal->creer) - { - print ''.$langs->trans('Modify').''; - } - - // ReOpen - if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) - { - print 'global->MAIN_JUMP_TAG)?'':'#reopen').'"'; - print '>'.$langs->trans('ReOpen').''; - } - - // Send - if ($object->statut == 1 || $object->statut == 2) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) - { - print ''.$langs->trans('SendByMail').''; - } - else print ''.$langs->trans('SendByMail').''; - } - - // Create an order - if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0) - { - if ($user->rights->commande->creer) - { - print ''.$langs->trans("AddOrder").''; - } - } - - // Create an invoice and classify billed - if ($object->statut == 2 && $user->societe_id == 0) - { - if (! empty($conf->facture->enabled) && $user->rights->facture->creer) - { - print ''.$langs->trans("AddBill").''; - } - - $arraypropal=$object->getInvoiceArrayList(); - if (is_array($arraypropal) && count($arraypropal) > 0) - { - print 'socid.'">'.$langs->trans("ClassifyBilled").''; - } - } - - // Close - if ($object->statut == 1 && $user->rights->propal->cloturer) - { - print 'global->MAIN_JUMP_TAG)?'':'#close').'"'; - print '>'.$langs->trans('Close').''; - } - - // Clone - if ($user->rights->propal->creer) - { - print ''.$langs->trans("ToClone").''; - } - - // Delete - if ($user->rights->propal->supprimer) - { - print ''.$langs->trans('Delete').''; - } - - } - - print '
'; - print "
\n"; -} - -if ($action != 'presend') -{ - print '
'; - print ''; // ancre - - - /* - * Documents generes - */ - $filename=dol_sanitizeFileName($object->ref); - $filedir=$conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed=$user->rights->propal->creer; - $delallowed=$user->rights->propal->supprimer; - - $var=true; - - $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang,$hookmanager); - - - /* - * Linked object block - */ - $somethingshown=$object->showLinkedObjectBlock(); - - print ''; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'propal',$socid); - - print '
'; -} - - -/* - * Action presend - * - */ -if ($action == 'presend') -{ - $ref = dol_sanitizeFileName($object->ref); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); - $file=$fileparams['fullname']; - - // Build document if it not exists - if (! $file || ! is_readable($file)) - { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); - $file=$fileparams['fullname']; - } - - print '
'; - print_titre($langs->trans('SendPropalByMail')); - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; - $formmail->withfrom=1; - $formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; - $formmail->withtosocid=$soc->id; - $formmail->withtocc=1; - $formmail->withtoccsocid=0; - $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); - $formmail->withtocccsocid=0; - $formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__'); - $formmail->withfile=2; - $formmail->withbody=1; - $formmail->withdeliveryreceipt=1; - $formmail->withcancel=1; - - // Tableau des substitutions - $formmail->substit['__PROPREF__']=$object->ref; - $formmail->substit['__SIGNATURE__']=$user->signature; - $formmail->substit['__PERSONALIZED__']=''; - // Tableau des parametres complementaires - $formmail->param['action']='send'; - $formmail->param['models']='propal_send'; - $formmail->param['id']=$object->id; - $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - - // Init list of files - if (GETPOST("mode")=='init') - { - $formmail->clear_attached_files(); - $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); - } - - $formmail->show_form(); - - print '
'; -} - - -// End of page -llxFooter(); -$db->close(); -?> + } + + $type = $prod->type; + } + else + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx)?1:0); + $tva_tx = str_replace('*', '', $tva_tx); + $label = (GETPOST('product_label')?GETPOST('product_label'):''); + $desc = $product_desc; + $type = GETPOST('type'); + } + + // Margin + $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); + $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); + + // Local Taxes + $localtax1_tx= get_localtax($tva_tx, 1, $object->client); + $localtax2_tx= get_localtax($tva_tx, 2, $object->client); + + $info_bits=0; + if ($tva_npr) $info_bits |= 0x01; + + if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + { + $mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').getCurrencySymbol($conf->currency)); + setEventMessage($mesg, 'errors'); + } + else + { + // Insert line + $result=$object->addline( + $id, + $desc, + $pu_ht, + GETPOST('qty'), + $tva_tx, + $localtax1_tx, + $localtax2_tx, + $idprod, + GETPOST('remise_percent'), + $price_base_type, + $pu_ttc, + $info_bits, + $type, + -1, + 0, + GETPOST('fk_parent_line'), + $fournprice, + $buyingprice, + $label + ); + + if ($result > 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['idprod']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + + // old method + unset($_POST['np_desc']); + unset($_POST['dp_desc']); + } + else + { + setEventMessage($object->error, 'errors'); + } + } + } +} + +// Mise a jour d'une ligne dans la propale +else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save') == $langs->trans("Save")) +{ + // Define info_bits + $info_bits=0; + if (preg_match('/\*/', GETPOST('tva_tx'))) $info_bits |= 0x01; + + // Clean parameters + $description=dol_htmlcleanlastbr(GETPOST('product_desc')); + + // Define vat_rate + $vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); + $vat_rate=str_replace('*','',$vat_rate); + $localtax1_rate=get_localtax($vat_rate,1,$object->client); + $localtax2_rate=get_localtax($vat_rate,2,$object->client); + $pu_ht=GETPOST('price_ht'); + + // Add buying price + $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); + $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); + + // Define special_code for special lines + $special_code=0; + if (! GETPOST('qty')) $special_code=3; + + // Check minimum price + $productid = GETPOST('productid', 'int'); + if (! empty($productid)) + { + $product = new Product($db); + $res=$product->fetch($productid); + + $type=$product->type; + + $price_min = $product->price_min; + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) + $price_min = $product->multiprices_min[$object->client->price_level]; + + $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); + + if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + { + setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors'); + $error++; + } + } + else + { + $type = GETPOST('type'); + $label = (GETPOST('product_label') ? GETPOST('product_label'):''); + + // Check parameters + if (GETPOST('type') < 0) { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); + $error++; + } + } + + if (! $error) + { + $result = $object->updateline( + GETPOST('lineid'), + $pu_ht, + GETPOST('qty'), + GETPOST('remise_percent'), + $vat_rate, + $localtax1_rate, + $localtax2_rate, + $description, + 'HT', + $info_bits, + $special_code, + GETPOST('fk_parent_line'), + 0, + $fournprice, + $buyingprice, + $label, + $type + ); + + if ($result >= 0) + { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['productid']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + } + else + { + setEventMessage($object->error, 'errors'); + } + } +} + +else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) +{ + header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition + exit; +} + +// Generation doc (depuis lien ou depuis cartouche doc) +else if ($action == 'builddoc' && $user->rights->propal->creer) +{ + if (GETPOST('model')) + { + $object->setDocModel($user, GETPOST('model')); + } + + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + $result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + else + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); + exit; + } +} + +// Remove file in doc form +else if ($action == 'remove_file' && $user->rights->propal->creer) +{ + if ($object->id > 0) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $langs->load("other"); + $upload_dir = $conf->propal->dir_output; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors'); + } +} + +// Set project +else if ($action == 'classin' && $user->rights->propal->creer) +{ + $object->setProject($_POST['projectid']); +} + +// Delai de livraison +else if ($action == 'setavailability' && $user->rights->propal->creer) +{ + $result = $object->availability($_POST['availability_id']); +} + +// Origine de la propale +else if ($action == 'setdemandreason' && $user->rights->propal->creer) +{ + $result = $object->demand_reason($_POST['demand_reason_id']); +} + +// Conditions de reglement +else if ($action == 'setconditions' && $user->rights->propal->creer) +{ + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id','int')); +} + +else if ($action == 'setremisepercent' && $user->rights->propal->creer) +{ + $result = $object->set_remise_percent($user, $_POST['remise_percent']); +} + +else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) +{ + $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); +} + +// Mode de reglement +else if ($action == 'setmode' && $user->rights->propal->creer) +{ + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); +} + +/* + * Ordonnancement des lignes + */ + +else if ($action == 'up' && $user->rights->propal->creer) +{ + $object->line_up(GETPOST('rowid')); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); + exit; +} + +else if ($action == 'down' && $user->rights->propal->creer) +{ + $object->line_down(GETPOST('rowid')); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $outputlangs = new Translate("",$conf); + $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $object->client->default_lang); + $outputlangs->setDefaultLang($newlang); + } + $ret=$object->fetch($id); // Reload to get new records + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + } + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid')); + exit; +} + +if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) +{ + if ($action == 'addcontact') + { + if ($object->id > 0) + { + $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); + $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); + } + + if ($result >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + $langs->load("errors"); + setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); + } + else + { + setEventMessage($object->error, 'errors'); + } + } + } + + // Bascule du statut d'un contact + else if ($action == 'swapstatut') + { + if ($object->fetch($id) > 0) + { + $result=$object->swapContactStatus(GETPOST('ligne')); + } + else + { + dol_print_error($db); + } + } + + // Efface un contact + else if ($action == 'deletecontact') + { + $object->fetch($id); + $result = $object->delete_contact($lineid); + + if ($result >= 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + dol_print_error($db); + } + } +} + + +/* + * View + */ + +llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); + +$form = new Form($db); +$formother = new FormOther($db); +$formfile = new FormFile($db); +$formpropal = new FormPropal($db); +$companystatic=new Societe($db); + +$now=dol_now(); + +/* + * Show object in view mode + */ + +$soc = new Societe($db); +$soc->fetch($object->socid); + +$head = propal_prepare_head($object); +dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); + +$formconfirm=''; + +// Clone confirmation +if ($action == 'clone') +{ + // Create an array for form + $formquestion=array( + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid','int'),'socid','(s.client=1 OR s.client=2 OR s.client=3)')) + ); + // Paiement incomplet. On demande si motif = escompte ou autre + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1); +} + +// Confirm delete +else if ($action == 'delete') +{ + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp',$object->ref), 'confirm_delete','',0,1); +} + +// Confirm reopen +else if ($action == 'reopen') +{ + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp',$object->ref), 'confirm_reopen','',0,1); +} + +// Confirmation delete product/service line +else if ($action == 'ask_deleteline') +{ + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1); +} + +// Confirm validate proposal +else if ($action == 'validate') +{ + $error=0; + + // on verifie si l'objet est en numerotation provisoire + $ref = substr($object->ref, 1, 4); + if ($ref == 'PROV') + { + $numref = $object->getNextNumRef($soc); + if (empty($numref)) + { + $error++; + dol_htmloutput_errors($object->error); + } + } + else + { + $numref = $object->ref; + } + + $text=$langs->trans('ConfirmValidateProp',$numref); + if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; + $notify=new Notify($db); + $text.='
'; + $text.=$notify->confirmMessage('NOTIFY_VAL_PROPAL',$object->socid); + } + + if (! $error) $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate','',0,1); +} + +if (! $formconfirm) +{ + $parameters=array('lineid'=>$lineid); + $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook +} + +// Print form confirm +print $formconfirm; + + +print ''; + +$linkback = ''.$langs->trans("BackToList").''; + +// Ref +print ''; + +// Ref client +print ''; +print ''; + +// Company +print ''; +print ''; + +// Ligne info remises tiers +print ''; + +// Date of proposal +print ''; +print ''; + +// Date end proposal +print ''; +print ''; +print ''; + +// Payment term +print ''; +print ''; + +// Delivery date +$langs->load('deliveries'); +print ''; +print ''; + +// Delivery delay +print ''; +print ''; + +// Origin of demand +print ''; +print ''; + +// Payment mode +print ''; +print ''; + +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + print ''; + } + else + { + print '
'.$langs->trans('Ref').''; +print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); +print '
'; +print ''; +if ($action != 'refclient' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('RefCustomer').''; +print ''.img_edit($langs->trans('Modify')).'
'; +print '
'; +if ($user->rights->propal->creer && $action == 'refclient') +{ + print '
'; + print ''; + print ''; + print ''; + print ' '; + print '
'; +} +else +{ + print $object->ref_client; +} +print '
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans('Discounts').''; +if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); +else print $langs->trans("CompanyHasNoRelativeDiscount"); +print '. '; +$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); +$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); +$absolute_discount=price2num($absolute_discount,'MT'); +$absolute_creditnote=price2num($absolute_creditnote,'MT'); +if ($absolute_discount) +{ + if ($object->statut > 0) + { + print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); + } + else + { + // Remise dispo de type non avoir + $filter='fk_facture_source IS NULL'; + print '
'; + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter); + } +} +if ($absolute_creditnote) +{ + print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'. '; +} +if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; +print '
'; +print ''; +if ($action != 'editdate' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('Date'); +print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; +print '
'; +if (! empty($object->brouillon) && $action == 'editdate') +{ + print '
'; + print ''; + print ''; + $form->select_date($object->date,'re','','',0,"editdate"); + print ''; + print '
'; +} +else +{ + if ($object->date) + { + print dol_print_date($object->date,'daytext'); + } + else + { + print ' '; + } +} +print '
'; +print ''; +if ($action != 'editecheance' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('DateEndPropal'); +print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; +print '
'; +if (! empty($object->brouillon) && $action == 'editecheance') +{ + print '
'; + print ''; + print ''; + $form->select_date($object->fin_validite,'ech','','','',"editecheance"); + print ''; + print '
'; +} +else +{ + if (! empty($object->fin_validite)) + { + print dol_print_date($object->fin_validite,'daytext'); + if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + } + else + { + print ' '; + } +} +print '
'; +print ''; +if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('PaymentConditionsShort'); +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'
'; +print '
'; +if ($action == 'editconditions') +{ + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); +} +else +{ + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); +} +print '
'; +print ''; +if ($action != 'editdate_livraison' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('DeliveryDate'); +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'
'; +print '
'; +if ($action == 'editdate_livraison') +{ + print '
'; + print ''; + print ''; + $form->select_date($object->date_livraison,'liv_','','','',"editdate_livraison"); + print ''; + print '
'; +} +else +{ + print dol_print_date($object->date_livraison,'daytext'); +} +print '
'; +print ''; +if ($action != 'editavailability' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('AvailabilityPeriod'); +if (! empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')'; +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'
'; +print '
'; +if ($action == 'editavailability') +{ + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'availability_id',1); +} +else +{ + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id,$object->availability_id,'none',1); +} + +print '
'; +print ''; +if ($action != 'editdemandreason' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('Source'); +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'
'; +print '
'; +//print $object->demand_reason_id; +if ($action == 'editdemandreason') +{ + $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); +} +else +{ + $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'none'); +} + +print '
'; +print ''; +if ($action != 'editmode' && ! empty($object->brouillon)) print ''; +print '
'; +print $langs->trans('PaymentMode'); +print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'
'; +print '
'; +if ($action == 'editmode') +{ + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); +} +else +{ + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); +} +print '
'; + print ''; + if ($user->rights->propal->creer) + { + if ($action != 'classify') print ''; + print '
'; + print $langs->trans('Project').''.img_edit($langs->transnoentitiesnoconv('SetProject')).'
'; + print '
'; + if ($action == 'classify') + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid'); + } + else + { + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none'); + } + print '
'; + if (! empty($object->fk_project)) + { + print ''; + $proj = new Project($db); + $proj->fetch($object->fk_project); + print ''; + print $proj->ref; + print ''; + print ''; + } + else { + print ' '; + } + } + print ''; +} + +// Other attributes +$parameters=array('colspan' => ' colspan="3"'); +$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook +if (empty($reshook) && ! empty($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; + print $extrafields->showInputField($key,$value); + print ''."\n"; + } +} + +// Amount HT +print ''.$langs->trans('AmountHT').''; +print ''.price($object->total_ht).''; +print ''.$langs->trans("Currency".$conf->currency).''; + +// Margin Infos +if (! empty($conf->margin->enabled)) { + print ''; + $object->displayMarginInfos(); + print ''; +} +print ''; + +// Amount VAT +print ''.$langs->trans('AmountVAT').''; +print ''.price($object->total_tva).''; +print ''.$langs->trans("Currency".$conf->currency).''; + +// Amount Local Taxes +if ($mysoc->localtax1_assuj=="1") //Localtax1 +{ + print ''.$langs->transcountry("AmountLT1",$mysoc->country_code).''; + print ''.price($object->total_localtax1).''; + print ''.$langs->trans("Currency".$conf->currency).''; +} +if ($mysoc->localtax2_assuj=="1") //Localtax2 +{ + print ''.$langs->transcountry("AmountLT2",$mysoc->country_code).''; + print ''.price($object->total_localtax2).''; + print ''.$langs->trans("Currency".$conf->currency).''; +} + + +// Amount TTC +print ''.$langs->trans('AmountTTC').''; +print ''.price($object->total_ttc).''; +print ''.$langs->trans("Currency".$conf->currency).''; + +// Statut +print ''.$langs->trans('Status').''.$object->getLibStatut(4).''; + +print '
'; + +if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) +{ + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; +} + +if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) +{ + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; +} + +/* + * Lines + */ + +if (! empty($conf->use_javascript_ajax) && $object->statut == 0) +{ + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; +} + +print ''; + +// Show object lines +$result = $object->getLinesArray(); +if (! empty($object->lines)) + $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager); + +// Form to add new line +if ($object->statut == 0 && $user->rights->propal->creer) +{ + if ($action != 'editline') + { + $var=true; + + if ($conf->global->MAIN_FEATURES_LEVEL > 1) + { + // Add free or predefined products/services + $object->formAddObjectLine(0,$mysoc,$soc,$hookmanager); + } + else + { + // Add free products/services + $object->formAddFreeProduct(0,$mysoc,$soc,$hookmanager); + + // Add predefined products/services + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) + { + $var=!$var; + $object->formAddPredefinedProduct(0,$mysoc,$soc,$hookmanager); + } + } + + $parameters=array(); + $reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + } +} + +print '
'; + +print ''; +print "\n"; + +if ($action == 'statut') +{ + /* + * Formulaire cloture (signe ou non) + */ + $form_close = '
'; + $form_close.= ''; + $form_close.= ''; + $form_close.= ''; + $form_close.= ''; + $form_close.= ''; + $form_close.= '
'.$langs->trans("CloseAs").''; + $form_close.= ''; + $form_close.= ''; + $form_close.= '
'.$langs->trans('Note').'
'; + $form_close.= ''; + $form_close.= '   '; + $form_close.= ' '; + $form_close.= '
'; + + print $form_close; +} + + +/* + * Boutons Actions + */ +if ($action != 'presend') +{ + print '
'; + + if ($action != 'statut' && $action <> 'editline') + { + // Validate + if ($object->statut == 0 && $user->rights->propal->valider) + { + if (count($object->lines) > 0) print ''.$langs->trans('Validate').''; + else print ''.$langs->trans('Validate').''; + } + + // Edit + if ($object->statut == 1 && $user->rights->propal->creer) + { + print ''.$langs->trans('Modify').''; + } + + // ReOpen + if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) + { + print 'global->MAIN_JUMP_TAG)?'':'#reopen').'"'; + print '>'.$langs->trans('ReOpen').''; + } + + // Send + if ($object->statut == 1 || $object->statut == 2) + { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) + { + print ''.$langs->trans('SendByMail').''; + } + else print ''.$langs->trans('SendByMail').''; + } + + // Create an order + if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0) + { + if ($user->rights->commande->creer) + { + print ''.$langs->trans("AddOrder").''; + } + } + + // Create an invoice and classify billed + if ($object->statut == 2 && $user->societe_id == 0) + { + if (! empty($conf->facture->enabled) && $user->rights->facture->creer) + { + print ''.$langs->trans("AddBill").''; + } + + $arraypropal=$object->getInvoiceArrayList(); + if (is_array($arraypropal) && count($arraypropal) > 0) + { + print 'socid.'">'.$langs->trans("ClassifyBilled").''; + } + } + + // Close + if ($object->statut == 1 && $user->rights->propal->cloturer) + { + print 'global->MAIN_JUMP_TAG)?'':'#close').'"'; + print '>'.$langs->trans('Close').''; + } + + // Clone + if ($user->rights->propal->creer) + { + print ''.$langs->trans("ToClone").''; + } + + // Delete + if ($user->rights->propal->supprimer) + { + print ''.$langs->trans('Delete').''; + } + + } + + print '
'; + print "
\n"; +} + +if ($action != 'presend') +{ + print '
'; + print ''; // ancre + + + /* + * Documents generes + */ + $filename=dol_sanitizeFileName($object->ref); + $filedir=$conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed=$user->rights->propal->creer; + $delallowed=$user->rights->propal->supprimer; + + $var=true; + + $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang,$hookmanager); + + + /* + * Linked object block + */ + $somethingshown=$object->showLinkedObjectBlock(); + + print ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'propal',$socid); + + print '
'; +} + + +/* + * Action presend + * + */ +if ($action == 'presend') +{ + $ref = dol_sanitizeFileName($object->ref); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/')); + $file=$fileparams['fullname']; + + // Build document if it not exists + if (! $file || ! is_readable($file)) + { + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $file=$fileparams['fullname']; + } + + print '
'; + print_titre($langs->trans('SendPropalByMail')); + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; + $formmail->fromname = $user->getFullName($langs); + $formmail->frommail = $user->email; + $formmail->withfrom=1; + $formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; + $formmail->withtosocid=$soc->id; + $formmail->withtocc=1; + $formmail->withtoccsocid=0; + $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); + $formmail->withtocccsocid=0; + $formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__'); + $formmail->withfile=2; + $formmail->withbody=1; + $formmail->withdeliveryreceipt=1; + $formmail->withcancel=1; + + // Tableau des substitutions + $formmail->substit['__PROPREF__']=$object->ref; + $formmail->substit['__SIGNATURE__']=$user->signature; + $formmail->substit['__PERSONALIZED__']=''; + // Tableau des parametres complementaires + $formmail->param['action']='send'; + $formmail->param['models']='propal_send'; + $formmail->param['id']=$object->id; + $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + + // Init list of files + if (GETPOST("mode")=='init') + { + $formmail->clear_attached_files(); + $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); + } + + $formmail->show_form(); + + print '
'; +} + + +// End of page +llxFooter(); +$db->close(); +?> From 1e3b26a104e04b62ca422fd19b295c2eb19f0653 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 29 Mar 2013 11:54:22 +0100 Subject: [PATCH 04/37] Fix: file with a specific mask not found, again --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8c357894b4a..286204b52a2 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3350,7 +3350,7 @@ else if ($id > 0 || ! empty($ref)) $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists From 6702386b8bb76f478a284ccf24defab57a2bc449 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 14:54:07 +0100 Subject: [PATCH 05/37] Some fix into chineese language files --- htdocs/langs/zh_CN/main.lang | 2 +- htdocs/langs/zh_TW/main.lang | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/zh_CN/main.lang b/htdocs/langs/zh_CN/main.lang index 31e8e03a2c5..04235a1bd69 100644 --- a/htdocs/langs/zh_CN/main.lang +++ b/htdocs/langs/zh_CN/main.lang @@ -1,5 +1,5 @@ /* - * Language code: zh_CN + * Language code: zh_CN (simplified) * Automatic generated via autotranslator.php tool * Generation date 2010-06-09 00:39:24 */ diff --git a/htdocs/langs/zh_TW/main.lang b/htdocs/langs/zh_TW/main.lang index 5712e8e5c03..b853fbb6073 100644 --- a/htdocs/langs/zh_TW/main.lang +++ b/htdocs/langs/zh_TW/main.lang @@ -1,13 +1,14 @@ /* - * Language code: zh_TW + * Language code: zh_TW (traditionnal) * Generation date 2012-09-04 16:02:00 */ // Reference language: en_US CHARSET=UTF-8 DIRECTION=ltr -#FONTFORPDF=chinese -FONTFORPDF=stsongstdlight +# msungstdlight or cid0ct are for traditionnal chinese (traditionnal does not render with ubuntu pdf reader) +# stsongstdlight or cid0cs are for simplified chinese +FONTFORPDF=msungstdlight #FONTSIZEFORPDF=9 SeparatorDecimal=. SeparatorThousand=None From f57320e697d460473027876e7972e40a08bc518c Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 29 Mar 2013 15:36:54 +0100 Subject: [PATCH 06/37] add numbering for supplier invoice --- .../fourn/class/fournisseur.facture.class.php | 38 +++++++++++-------- htdocs/fourn/facture/fiche.php | 29 +++++++++++++- htdocs/fourn/facture/index.php | 3 +- .../install/mysql/migration/3.3.0-3.4.0.sql | 6 +-- 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 840c4cecb94..019b36f7fdf 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2013 Philippe Grand * * 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 @@ -40,7 +41,7 @@ class FactureFournisseur extends CommonInvoice public $fk_element='fk_facture_fourn'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - var $ref; // TODO deprecated + var $ref; var $product_ref; var $ref_supplier; var $socid; @@ -132,7 +133,8 @@ class FactureFournisseur extends CommonInvoice $totalht = ($amount - $remise); $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn ("; - $sql.= "facnumber"; + $sql.= "ref"; + $sql.= ", facnumber"; $sql.= ", entity"; $sql.= ", libelle"; $sql.= ", fk_soc"; @@ -144,7 +146,8 @@ class FactureFournisseur extends CommonInvoice $sql.= ", date_lim_reglement"; $sql.= ")"; $sql.= " VALUES ("; - $sql.= "'".$this->db->escape($number)."'"; + $sql.= "'(PROV)'"; + $sql.= ", '".$this->db->escape($number)."'"; $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->escape($this->libelle)."'"; $sql.= ", ".$this->socid; @@ -259,6 +262,7 @@ class FactureFournisseur extends CommonInvoice $sql = "SELECT"; $sql.= " t.rowid,"; + $sql.= " t.ref,"; $sql.= " t.facnumber,"; $sql.= " t.entity,"; $sql.= " t.type,"; @@ -294,7 +298,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' s.nom as socnom, s.rowid as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t,'.MAIN_DB_PREFIX.'societe as s'; if ($id) $sql.= " WHERE t.rowid=".$id; - if ($ref) $sql.= " WHERE t.rowid='".$this->db->escape($ref)."'"; // ref is id (facnumber is supplier ref) + if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; // ref is id (facnumber is supplier ref) $sql.= ' AND t.fk_soc = s.rowid'; dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); @@ -306,7 +310,7 @@ class FactureFournisseur extends CommonInvoice $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; - $this->ref = $obj->rowid; + $this->ref = $obj->ref; $this->ref_supplier = $obj->facnumber; $this->facnumber = $obj->facnumber; @@ -459,6 +463,7 @@ class FactureFournisseur extends CommonInvoice $error=0; // Clean parameters + if (isset($this->ref)) $this->ref=trim($this->ref); if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); if (isset($this->entity)) $this->entity=trim($this->entity); if (isset($this->type)) $this->type=trim($this->type); @@ -495,6 +500,7 @@ class FactureFournisseur extends CommonInvoice // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET"; + $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; $sql.= " facnumber=".(isset($this->facnumber)?"'".$this->db->escape($this->facnumber)."'":"null").","; $sql.= " entity=".(isset($this->entity)?$this->entity:"null").","; $sql.= " type=".(isset($this->type)?$this->type:"null").","; @@ -834,7 +840,7 @@ class FactureFournisseur extends CommonInvoice } $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn"; - $sql.= " SET fk_statut = 1, fk_user_valid = ".$user->id; + $sql.= " SET ref='".$num."', fk_statut = 1, fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::validate sql=".$sql); @@ -1181,17 +1187,17 @@ class FactureFournisseur extends CommonInvoice dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); $error=0; - $this->db->begin(); + $this->db->begin(); if (! $error && ! $notrigger) { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } // Fin appel triggers } @@ -1213,7 +1219,7 @@ class FactureFournisseur extends CommonInvoice if (! $error) { // Mise a jour prix facture - $this->update_price(); + $this->update_price(); } if (! $error) @@ -1519,7 +1525,7 @@ class FactureFournisseur extends CommonInvoice $object->statut=0; // Clear fields - $object->ref_supplier=$langs->trans("CopyOf").' '.$object->ref_supplier; + $object->ref=$langs->trans("CopyOf").' '.$object->ref; $object->author = $user->id; $object->user_valid = ''; $object->fk_facture_source = 0; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index b8b4c209cb3..8d33e97f499 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -5,6 +5,7 @@ * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2013 Philippe Grand * * 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 @@ -49,6 +50,7 @@ $errors=array(); $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); $action = GETPOST("action"); $confirm = GETPOST("confirm"); +$ref = GETPOST('ref','alpha'); //PDF $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -65,6 +67,12 @@ $hookmanager->initHooks(array('invoicesuppliercard')); $object=new FactureFournisseur($db); +// Load object +if ($id > 0 || ! empty($ref)) +{ + $ret=$object->fetch($id, $ref); +} + /* @@ -258,7 +266,8 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) $db->begin(); // Creation facture - $object->ref = $_POST['facnumber']; + $object->ref = $_POST['ref']; + $object->facnumber = $_POST['facnumber']; $object->socid = $_POST['socid']; $object->libelle = $_POST['libelle']; $object->date = $datefacture; @@ -1281,6 +1290,22 @@ else // Confirmation de la validation if ($action == 'valid') { + // on verifie si l'objet est en numerotation provisoire + $objectref = substr($object->ref, 1, 4); + if ($objectref == 'PROV') + { + $savdate=$object->date; + if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) + { + $object->date=dol_now(); + $object->date_lim_reglement=$object->calculate_date_lim_reglement(); + } + $numref = $object->getNextNumRef($soc); + } + else + { + $numref = $object->ref; + } $formquestion=array(); if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $object->hasProductsOrServices(1)) { @@ -1322,7 +1347,7 @@ else // Ref print ''.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref'); + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print ''; print "\n"; diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index 6181ec15b24..b5922f52b29 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2002-2006 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Philippe Grand * * 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 @@ -102,7 +103,7 @@ $htmlother=new FormOther($db); llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); $sql = "SELECT s.rowid as socid, s.nom, "; -$sql.= " fac.rowid as ref, fac.rowid as facid, fac.facnumber, fac.datef, fac.date_lim_reglement as date_echeance,"; +$sql.= " fac.rowid as facid, fac.ref, fac.facnumber, fac.datef, fac.date_lim_reglement as date_echeance,"; $sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac"; diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 571ba7373a2..db609d76ad1 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -48,6 +48,9 @@ alter table llx_contratdet add column buy_price_ht double(24,8) DEFAULT 0 after -- serialised array, to store value of select list choices for example alter table llx_extrafields add column param text after pos; +-- numbering on supplier invoice +alter table llx_facture_fourn add column ref varchar(30) NOT NULL after rowid; + alter table llx_propal CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; alter table llx_commande CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; @@ -205,6 +208,3 @@ ALTER TABLE llx_user ADD COLUMN town varchar(50); ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0; ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0; - - - From 006050b6cd8c32b1bfdc37f01ddecb8c7de0b405 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 15:39:35 +0100 Subject: [PATCH 07/37] Fix: left menu not always opened --- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 61aaec75fc1..f6b58699919 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -414,8 +414,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu = $menu; $mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]); - $leftmenu=($forceleftmenu?'':$_SESSION["leftmenu"]); - + $leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"])); + // Show logo company if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO)) { From 8f331adff61ebb3f0841d51648242abe6d824e50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 16:16:26 +0100 Subject: [PATCH 08/37] New: Work on men management rewrite --- htdocs/core/menus/standard/auguria.lib.php | 106 +++++++++++--------- htdocs/core/menus/standard/auguria_menu.php | 52 +++++++++- htdocs/core/menus/standard/eldy.lib.php | 7 +- htdocs/core/menus/standard/eldy_menu.php | 2 +- 4 files changed, 110 insertions(+), 57 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 18ffe81ecdd..6faf6e90a50 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -30,12 +30,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * * @param DoliDB $db Database handler * @param string $atarget Target - * @param int $type_user 0=Internal,1=External,2=All + * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param array &$menu Object Menu to return back list of menu entries + * @param int $noout Disable output (Initialise &$menu only). * @return void */ -function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu) +function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) { global $user,$conf,$langs,$dolibarr_main_db_name; @@ -45,11 +46,11 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu) $id='mainmenu'; $listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL); - //$tabMenu=array(); + // Show personalized menus $menuArbo = new Menubase($db,'auguria'); $newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'auguria',$tabMenu); - print_start_menu_array_auguria(); + if (empty($noout)) print_start_menu_array_auguria(); $num = count($newTabMenu); for($i = 0; $i < $num; $i++) @@ -59,24 +60,23 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu) $showmode=dol_auguria_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal); if ($showmode == 1) { - // Define url - if (preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) + $url = $shorturl = $newTabMenu[$i]['url']; + if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) { - $url = $newTabMenu[$i]['url']; - } - else - { - $url=dol_buildpath($newTabMenu[$i]['url'],1); + $param=''; if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) { - if (! preg_match('/\?/',$url)) $url.='?'; - else $url.='&'; - $url.='mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; + if (! preg_match('/\?/',$url)) $param.='?'; + else $param.='&'; + $param.='mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; } //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad + $url=dol_buildpath($url,1).$param; + $shorturl = $newTabMenu[$i]['url'].$param; } $url=preg_replace('/__LOGIN__/',$user->login,$url); - + $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); + // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; else if (! empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname='class="tmenusel"'; @@ -84,12 +84,13 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu) } else if ($showmode == 2) $classname='class="tmenu"'; - print_start_menu_entry_auguria($idsel,$classname,$showmode); - print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); - print_end_menu_entry_auguria($showmode); + if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode); + if (empty($noout)) print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); + if (empty($noout)) print_end_menu_entry_auguria($showmode); + $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ''); } - print_end_menu_array_auguria(); + if (empty($noout)) print_end_menu_array_auguria(); print "\n"; } @@ -127,7 +128,7 @@ function print_start_menu_entry_auguria($idsel,$classname,$showmode) * Output menu entry * * @param string $text Text - * @param int $showmode 1 = allowed or 2 = not allowed + * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed * @param string $url Url * @param string $id Id * @param string $idsel Id sel @@ -142,7 +143,7 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla if ($showmode == 1) { print ''; - print '
'; + print '
'; print '
'; print ''; print ''; @@ -152,7 +153,7 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla } if ($showmode == 2) { - print '
'; + print '
'; print '
'; print ''; print $text; @@ -172,8 +173,8 @@ function print_end_menu_entry_auguria($showmode) if ($showmode) { print ''; - print "\n"; } + print "\n"; } /** @@ -198,20 +199,22 @@ function print_end_menu_array_auguria() * @param array $menu_array_after Table of menu entries to show after entries of menu handler * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param array &$menu Object Menu to return back list of menu entries + * @param int $noout Disable output (Initialise &$menu only). + * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' + * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) * @return void */ -function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu) +function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='') { global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc; - $overwritemenufor = array(); $newmenu = $menu; - $mainmenu=$_SESSION["mainmenu"]; - $leftmenu=$_SESSION["leftmenu"]; + $mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]); + $leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"])); // Show logo company - if (! empty($conf->global->MAIN_SHOW_LOGO)) + if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO)) { $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) @@ -245,23 +248,21 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM if (! is_array($menu_array)) return 0; // Show menu + if (empty($noout)) + { $alt=0; $num=count($menu_array); for ($i = 0; $i < $num; $i++) { + $showmenu=true; + if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false; + $alt++; - if (empty($menu_array[$i]['level'])) + if (empty($menu_array[$i]['level']) && $showmenu) { if (($alt%2==0)) { - if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION)) - { - print '
'."\n"; - } - else - { - print '
'."\n"; - } + print '
'."\n"; } else { @@ -290,7 +291,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM $url.='mainmenu='.$mainmenu; } - print ''."\n"; + print ''."\n"; // Menu niveau 0 if ($menu_array[$i]['level'] == 0) @@ -299,35 +300,42 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM { print ''; } - else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) + else if ($showmenu) { - print ''; + print ''."\n"; } - print "\n".'
'."\n"; - print ''."\n"; + if ($showmenu) + print ''."\n"; } // Menu niveau > 0 if ($menu_array[$i]['level'] > 0) { if ($menu_array[$i]['enabled']) { - print ''; + print ''."\n"; } - else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) + else if ($showmenu) { - print ''; + print ''."\n"; } } // If next is a new block or end if (empty($menu_array[$i+1]['level'])) { - print ''."\n"; - print "
\n"; - print "
\n"; + if ($showmenu) + print ''."\n"; + print "
\n"; } } - + } + return count($menu_array); } diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 1aeb8d8ac98..19b4b15764f 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -151,12 +151,12 @@ class MenuManager /** * Show menu * - * @param string $mode 'top' or 'left' + * @param string $mode 'top', 'left', 'jmobile' * @return int Number of menu entries shown */ function showmenu($mode) { - global $conf; + global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php'; @@ -173,7 +173,53 @@ class MenuManager if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); - + if ($mode == 'jmobile') + { + $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); + + foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + print '
    '; + print '
  • '; + if ($val['enabled'] == 1) + { + $relurl=dol_buildpath($val['url'],1); + + print ''.$val['titre'].''."\n"; + // Search submenu fot this entry + $tmpmainmenu=$val['mainmenu']; + $tmpleftmenu='all'; + $submenu=new Menu(); + $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); + $nexturl=dol_buildpath($submenu->liste[0]['url'],1); + $canonrelurl=preg_replace('/\?.*$/','',$relurl); + $canonnexturl=preg_replace('/\?.*$/','',$nexturl); + //var_dump($canonrelurl); + //var_dump($canonnexturl); + print '
      '; + if ($canonrelurl != $canonnexturl && $val['mainmenu'] != 'home') + { + // We add sub entry + print '
    • '.$langs->trans("MainArea").'-'.$val['titre'].'
    • '."\n"; + } + foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + $relurl2=dol_buildpath($val2['url'],1); + //var_dump($val2); + print ''.$val2['titre'].''."\n"; + } + //var_dump($submenu); + print '
    '; + } + if ($val['enabled'] == 2) + { + print ''.$val['titre'].''; + } + print '
  • '; + print '
'."\n"; + } + } + unset($this->menu); return $res; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f6b58699919..23970e6897c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -264,10 +264,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $showmode=dol_eldy_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal); if ($showmode == 1) { - $url = $newTabMenu[$i]['url']; + $url = $shorturl = $newTabMenu[$i]['url']; if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) { - $url = $newTabMenu[$i]['url']; $param=''; if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) { @@ -436,8 +435,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } /** - * On definit newmenu en fonction de mainmenu et leftmenu - * ------------------------------------------------------ + * We update newmenu with entries found into database + * -------------------------------------------------- */ if ($mainmenu) { diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index eb050232366..fdf3a93e2fb 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -140,7 +140,7 @@ class MenuManager if ($val['enabled'] == 1) { $relurl=dol_buildpath($val['url'],1); - + print ''.$val['titre'].''."\n"; // Search submenu fot this entry $tmpmainmenu=$val['mainmenu']; From 4c47393b51adba844584765c0050287877b01c94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 16:18:55 +0100 Subject: [PATCH 09/37] Fix: Add more ODT tags --- .../core/class/commondocgenerator.class.php | 31 ++++++++++++++++++- .../doc/doc_generic_invoice_odt.modules.php | 4 ++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 9561aa288fb..36eb166f499 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -51,7 +51,14 @@ abstract class CommonDocGenerator 'myuser_firstname'=>$user->firstname, 'myuser_login'=>$user->login, 'myuser_phone'=>$user->office_phone, - 'myuser_fax'=>$user->office_fax, + 'myuser_address'=>$user->address, + 'myuser_zip'=>$user->zip, + 'myuser_town'=>$user->town, + 'myuser_country'=>$user->country, + 'myuser_country_code'=>$user->country_code, + 'myuser_state'=>$user->state, + 'myuser_state_code'=>$user->state_code, + 'myuser_fax'=>$user->office_fax, 'myuser_mobile'=>$user->user_mobile, 'myuser_email'=>$user->email, 'myuser_web'=>'' // url not exist in $user object @@ -190,6 +197,28 @@ abstract class CommonDocGenerator } + /** + * Define array with couple subtitution key => subtitution value + * + * @param Translate $outputlangs Language object for output + * @return array Array of substitution key->code + */ + function get_substitutionarray_other($outputlangs) + { + global $conf; + + $now=dol_now('gmt'); // gmt + $array_other = array( + 'current_date'=>dol_print_date($now,'day','tzuser'), + 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), + 'current_server_date'=>dol_print_date($now,'day','tzserver'), + 'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'), + ); + + return $array_other; + } + + /** * Define array with couple substitution key => substitution value * diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index ee80dbbb141..753446b10ad 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -117,6 +117,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_date_creation'=>dol_print_date($object->date_creation,'day'), 'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''), 'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'), + 'object_date_delivery_planed'=>dol_print_date($object->date_livraison,'dayhour'), 'object_payment_mode_code'=>$object->mode_reglement_code, 'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), 'object_payment_term_code'=>$object->cond_reglement_code, @@ -415,7 +416,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); $array_objet=$this->get_substitutionarray_object($object,$outputlangs); $array_propal=is_object($propal_object)?$this->get_substitutionarray_propal($propal_object,$outputlangs,'propal'):array(); - + $array_other=$this->get_substitutionarray_other($user,$outputlangs); + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal); complete_substitutions_array($tmparray, $outputlangs, $object); From 97a90b09048f867509ba577861a69e568b76765b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2013 16:45:40 +0100 Subject: [PATCH 10/37] New: Add more ODT tags --- .../modules/commande/doc/doc_generic_order_odt.modules.php | 5 +++-- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 4ba2a560f5d..7ec078099db 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -105,8 +105,9 @@ class doc_generic_order_odt extends ModelePDFCommandes 'object_date'=>dol_print_date($object->date,'day'), 'object_date_delivery'=>dol_print_date($object->date_livraison,'dayhour'), 'object_date_creation'=>dol_print_date($object->date_creation,'day'), - 'object_date_modification'=>dol_print_date($object->date_modification,'day'), - 'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'), + 'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''), + 'object_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''), + 'object_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''), 'object_date_close'=>dol_print_date($object->date_cloture,'dayhour'), 'object_payment_mode_code'=>$object->mode_reglement_code, 'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 753446b10ad..393804c580a 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -116,8 +116,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_date_limit'=>dol_print_date($object->date_lim_reglement,'day'), 'object_date_creation'=>dol_print_date($object->date_creation,'day'), 'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''), - 'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'), - 'object_date_delivery_planed'=>dol_print_date($object->date_livraison,'dayhour'), + 'object_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''), + 'object_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''), 'object_payment_mode_code'=>$object->mode_reglement_code, 'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), 'object_payment_term_code'=>$object->cond_reglement_code, From 11d2cb1e1c0d17a33d58dd85f76a08b35fa9e7d3 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 29 Mar 2013 17:18:47 +0100 Subject: [PATCH 11/37] fix: ref_suplier instead of ref for add numbering for supplier invoice --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 019b36f7fdf..5b26339c8c8 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1525,7 +1525,7 @@ class FactureFournisseur extends CommonInvoice $object->statut=0; // Clear fields - $object->ref=$langs->trans("CopyOf").' '.$object->ref; + $object->ref_supplier=$langs->trans("CopyOf").' '.$object->ref_supplier; $object->author = $user->id; $object->user_valid = ''; $object->fk_facture_source = 0; From d8090ba994a7ffc66f977d24f1310ad4139f7117 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 29 Mar 2013 18:47:53 +0100 Subject: [PATCH 12/37] Fix : "Firstname" was used as var instead of "firstname" --- htdocs/user/fiche.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 1ef52efc85b..0d2586c9639 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1089,7 +1089,7 @@ else // Firstname print ''.$langs->trans("Firstname").''; - print ''.$object->Firstname.''; + print ''.$object->firstname.''; print ''."\n"; // Position/Job @@ -1588,12 +1588,12 @@ else print ''; if ($caneditfield && !$object->ldap_sid) { - print ''; + print ''; } else { - print ''; - print $object->Firstname; + print ''; + print $object->firstname; } print ''; From 2309a4b81b80a3ce21d37ff7677769b823a37b8c Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 29 Mar 2013 18:56:01 +0100 Subject: [PATCH 13/37] Fix : on holiday list on a specific user, user and validator were not displayed --- htdocs/holiday/class/holiday.class.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c97d2f1384e..27e45118fa8 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -267,10 +267,17 @@ class Holiday extends CommonObject $sql.= " cp.fk_user_refuse,"; $sql.= " cp.date_cancel,"; $sql.= " cp.fk_user_cancel,"; - $sql.= " cp.detail_refuse"; + $sql.= " cp.detail_refuse,"; + + $sql.= " uu.lastname as user_lastname,"; + $sql.= " uu.firstname as user_firstname,"; - $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp"; - $sql.= " WHERE cp.fk_user = '".$user_id."'"; + $sql.= " ua.lastname as validator_lastname,"; + $sql.= " ua.firstname as validator_firstname"; + + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua"; + $sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau + $sql.= " AND cp.fk_user = '".$user_id."'"; // Filtre de séléction if(!empty($filter)) { @@ -320,6 +327,12 @@ class Holiday extends CommonObject $tab_result[$i]['fk_user_cancel'] = $obj->fk_user_cancel; $tab_result[$i]['detail_refuse'] = $obj->detail_refuse; + $tab_result[$i]['user_firstname'] = $obj->user_firstname; + $tab_result[$i]['user_lastname'] = $obj->user_lastname; + + $tab_result[$i]['validator_firstname'] = $obj->validator_firstname; + $tab_result[$i]['validator_lastname'] = $obj->validator_lastname; + $i++; } From 701814ad199678789bc08ec0cf8744f83e28905c Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 29 Mar 2013 21:19:22 +0100 Subject: [PATCH 14/37] Update mysqli.class.php --- htdocs/core/db/mysqli.class.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 2180546dc39..e2db251db1c 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -879,22 +879,27 @@ class DoliDBMysqli { $sqlfields[$i] = $field_name." "; $sqlfields[$i] .= $field_desc['type']; + if( preg_match("/^[^\s]/i",$field_desc['value'])) - $sqlfields[$i] .= "(".$field_desc['value'].")"; - else if( preg_match("/^[^\s]/i",$field_desc['attribute'])) - $sqlfields[$i] .= " ".$field_desc['attribute']; - else if( preg_match("/^[^\s]/i",$field_desc['default'])) + $sqlfields[$i] .= "(".$field_desc['value'].")"; + + if( preg_match("/^[^\s]/i",$field_desc['attribute'])) + $sqlfields[$i] .= " ".$field_desc['attribute']; + + if( preg_match("/^[^\s]/i",$field_desc['default'])) { if(preg_match("/null/i",$field_desc['default'])) - $sqlfields[$i] .= " default ".$field_desc['default']; + $sqlfields[$i] .= " default ".$field_desc['default']; + elseif ($field_desc['default'] == 'CURRENT_TIMESTAMP') + $sqlfields[$i] .= " default ".$field_desc['default']; else - $sqlfields[$i] .= " default '".$field_desc['default']."'"; + $sqlfields[$i] .= " default '".$field_desc['default']."'"; } - else if( preg_match("/^[^\s]/i",$field_desc['null'])) - $sqlfields[$i] .= " ".$field_desc['null']; + if( preg_match("/^[^\s]/i",$field_desc['null'])) + $sqlfields[$i] .= " ".$field_desc['null']; - else if( preg_match("/^[^\s]/i",$field_desc['extra'])) - $sqlfields[$i] .= " ".$field_desc['extra']; + if( preg_match("/^[^\s]/i",$field_desc['extra'])) + $sqlfields[$i] .= " ".$field_desc['extra']; $i++; } if($primary_key != "") From c75ce979600cb22a958ca07d8d15988eaaa9a14b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 13:30:44 +0100 Subject: [PATCH 15/37] Update es_MX --- htdocs/langs/es_MX/banks.lang | 3 ++ htdocs/langs/es_MX/bills.lang | 51 ++++++++++++++++-------------- htdocs/langs/es_MX/categories.lang | 3 ++ htdocs/langs/es_MX/companies.lang | 8 +++-- htdocs/langs/es_MX/main.lang | 7 ++++ 5 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 htdocs/langs/es_MX/banks.lang create mode 100644 htdocs/langs/es_MX/categories.lang create mode 100644 htdocs/langs/es_MX/main.lang diff --git a/htdocs/langs/es_MX/banks.lang b/htdocs/langs/es_MX/banks.lang new file mode 100644 index 00000000000..58ef3a65d00 --- /dev/null +++ b/htdocs/langs/es_MX/banks.lang @@ -0,0 +1,3 @@ +# Dolibarr language file - es_MX - banks +CHARSET=UTF-8 +BankAccountDomiciliation=Tarjeta \ No newline at end of file diff --git a/htdocs/langs/es_MX/bills.lang b/htdocs/langs/es_MX/bills.lang index 4afc7e178f8..ef60be41921 100644 --- a/htdocs/langs/es_MX/bills.lang +++ b/htdocs/langs/es_MX/bills.lang @@ -1,23 +1,28 @@ -# Dolibarr language file - es_MX - bills -CHARSET=UTF-8 -InvoiceAvoir=Nota de crédito -InvoiceAvoirAsk=Nota de crédito para corregir la factura -InvoiceAvoirDesc=La nota de crédito es una factura negativa destinada a compensar un importe de factura que difiere del importe realmente pagado (por haber pagado de más o por devolución de productos, por ejemplo). -InvoiceHasAvoir=Corregida por una o más notas de crédito -ConfirmConvertToReduc=¿Quiere convertir esta nota de crédito en una reducción futura?
El importe de esta nota de crédito se almacenará para este cliente. Podrá utilizarse para reducir el importe de una próxima factura del cliente. -AddBill=Crear factura o nota de crédito -EnterPaymentDueToCustomer=Realizar pago de notas de crédito al cliente -ErrorInvoiceAvoirMustBeNegative=Error, una factura de tipo nota de crédito debe tener un importe negativo -ConfirmClassifyPaidPartiallyReasonAvoir=El resto a pagar (%s %s) se ha regularizado (ya que artículo se ha devuelto, olvidado entregar, descuento no definido...) mediante una nota de crédito -ConfirmClassifyPaidPartiallyReasonOtherDesc=Esta elección será posible, por ejemplo, en los casos siguiente:
-pago parcial ya que una partida de productos se ha devuleto.
- reclamado por no entregar productos de la factura
En todos los casos, la reclamación debe regularizarse mediante una nota de crédito -ShowInvoiceAvoir=Ver nota de crédito -AlreadyPaidNoCreditNotesNoDeposits=Ya pagado (excluidos las notas de crédito y anticipos) -ShowDiscount=Ver la nota de crédito -CreditNote=Nota de crédito -CreditNotes=Notas de crédito -DiscountFromCreditNote=Descuento resultante de la nota de crédito %s -AbsoluteDiscountUse=Este tipo de crédito no puede ser utilizado en una factura antes de su validación -CreditNoteDepositUse=La factura debe de estar validada para poder utilizar este tipo de créditos -CreditNoteConvertedIntoDiscount=Esta nota de crédito se convirtió en %s -TerreNumRefModelDesc1=Devuelve el número bajo el formato %syymm-nnnn para las facturas y %syymm-nnnn para las notas de crédito donde yy es el año, mm. el mes y nnnn un contador secuencial sin ruptura y sin permanencia a 0 -AddCreditNote=Crear nota de crédito \ No newline at end of file +# Dolibarr language file - es_MX - bills +CHARSET=UTF-8 +InvoiceAvoir=Nota de crédito +InvoiceAvoirAsk=Nota de crédito para corregir la factura +InvoiceAvoirDesc=La nota de crédito es una factura negativa destinada a compensar un importe de factura que difiere del importe realmente pagado (por haber pagado de más o por devolución de productos, por ejemplo). +InvoiceHasAvoir=Corregida por una o más notas de crédito +ConfirmConvertToReduc=¿Quiere convertir esta nota de crédito en una reducción futura?
El importe de esta nota de crédito se almacenará para este cliente. Podrá utilizarse para reducir el importe de una próxima factura del cliente. +AddBill=Crear factura o nota de crédito +EnterPaymentDueToCustomer=Realizar pago de notas de crédito al cliente +ErrorInvoiceAvoirMustBeNegative=Error, una factura de tipo nota de crédito debe tener un importe negativo +ConfirmClassifyPaidPartiallyReasonAvoir=El resto a pagar (%s %s) se ha regularizado (ya que artículo se ha devuelto, olvidado entregar, descuento no definido...) mediante una nota de crédito +ConfirmClassifyPaidPartiallyReasonOtherDesc=Esta elección será posible, por ejemplo, en los casos siguiente:
-pago parcial ya que una partida de productos se ha devuleto.
- reclamado por no entregar productos de la factura
En todos los casos, la reclamación debe regularizarse mediante una nota de crédito +ShowInvoiceAvoir=Ver nota de crédito +AlreadyPaidNoCreditNotesNoDeposits=Ya pagado (excluidos las notas de crédito y anticipos) +ShowDiscount=Ver la nota de crédito +CreditNote=Nota de crédito +CreditNotes=Notas de crédito +DiscountFromCreditNote=Descuento resultante de la nota de crédito %s +AbsoluteDiscountUse=Este tipo de crédito no puede ser utilizado en una factura antes de su validación +CreditNoteDepositUse=La factura debe de estar validada para poder utilizar este tipo de créditos +CreditNoteConvertedIntoDiscount=Esta nota de crédito se convirtió en %s +TerreNumRefModelDesc1=Devuelve el número bajo el formato %syymm-nnnn para las facturas y %syymm-nnnn para las notas de crédito donde yy es el año, mm. el mes y nnnn un contador secuencial sin ruptura y sin permanencia a 0 +AddCreditNote=Crear nota de crédito +BillTo=Receptor +Residence=Tarjeta +IBANNumber=CLABE Interbancaria +BICNumber=Sucursal +PaymentByTransferOnThisBankAccount=Cuenta para depositos y transferencias \ No newline at end of file diff --git a/htdocs/langs/es_MX/categories.lang b/htdocs/langs/es_MX/categories.lang new file mode 100644 index 00000000000..8904c443bcf --- /dev/null +++ b/htdocs/langs/es_MX/categories.lang @@ -0,0 +1,3 @@ +# Dolibarr language file - es_MX - categories +CHARSET=UTF-8 +NotCategorized=Sin Categoría \ No newline at end of file diff --git a/htdocs/langs/es_MX/companies.lang b/htdocs/langs/es_MX/companies.lang index bef45bb79b8..99dd8ca9896 100644 --- a/htdocs/langs/es_MX/companies.lang +++ b/htdocs/langs/es_MX/companies.lang @@ -1,3 +1,5 @@ -# Dolibarr language file - es_MX - companies -CHARSET=UTF-8 -CompanyHasCreditNote=Este cliente tiene %s %s notas de crédito/anticipos disponibles +# Dolibarr language file - es_MX - companies +CHARSET=UTF-8 +State=Estado +Town=Municipio +CompanyHasCreditNote=Este cliente tiene %s %s notas de crédito/anticipos disponibles \ No newline at end of file diff --git a/htdocs/langs/es_MX/main.lang b/htdocs/langs/es_MX/main.lang new file mode 100644 index 00000000000..323ec95b1e3 --- /dev/null +++ b/htdocs/langs/es_MX/main.lang @@ -0,0 +1,7 @@ +# Dolibarr language file - es_MX - main +CHARSET=UTF-8 +SeparatorDecimal=. +SeparatorThousand=, +AmountHT=Subtotal +TotalHT=Subtotal +TotalVAT=IVA \ No newline at end of file From a5e66ab7ba3bf5b9d8e5f643a046ebf629d186ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 13:54:46 +0100 Subject: [PATCH 16/37] Generalize fix: file with a specific mask not found, again --- htdocs/comm/propal.php | 42 ++++++++++++++++----------------- htdocs/commande/fiche.php | 12 +++++----- htdocs/compta/facture.php | 22 ++++++++--------- htdocs/expedition/fiche.php | 16 ++++++------- htdocs/fichinter/fiche.php | 14 +++++------ htdocs/fourn/commande/fiche.php | 4 ++-- htdocs/fourn/facture/fiche.php | 4 ++-- 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 7cf90691655..cea565515b5 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1107,7 +1107,7 @@ else if ($action == 'update_extras') // Fill array 'array_options' with data from update form $extralabels=$extrafields->fetch_name_optionals_label('propal'); $ret = $extrafields->setOptionalsFromPost($extralabels,$object); - + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('propaldao')); @@ -1125,7 +1125,7 @@ else if ($action == 'update_extras') } } else if ($reshook < 0) $error++; - + } if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) @@ -1350,13 +1350,13 @@ if ($action == 'create') foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - + // Show separator only if ($extrafields->attribute_type[$key] == 'separate') { print $extrafields->showSeparator($key); } - else + else { print 'attribute_required[$key])) print ' class="fieldrequired"'; @@ -1840,7 +1840,7 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { - + if ($action == 'edit_extras') { print '
'; @@ -1848,8 +1848,8 @@ else print ''; print ''; } - - + + foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); @@ -1862,13 +1862,13 @@ else print 'attribute_required[$key])) print ' class="fieldrequired"'; print '>'.$label.''; - + // Convert date into timestamp format if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) { $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; } - + if ($action == 'edit_extras' && $user->rights->propal->creer) { print $extrafields->showInputField($key,$value); @@ -1880,19 +1880,19 @@ else print ''."\n"; } } - + if(count($extrafields->attribute_label) > 0) { - + if ($action == 'edit_extras' && $user->rights->propal->creer) { print ''; print ''; print ''; print ''; - + } else { - if ($object->statut == 0 && $user->rights->propal->creer) + if ($object->statut == 0 && $user->rights->propal->creer) { print ''.img_picto('','edit').' '.$langs->trans('Modify').''; } @@ -2182,7 +2182,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2205,7 +2205,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -2236,12 +2236,12 @@ else $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + //Find the good contact adress $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_propal_external_CUSTOMER')) { @@ -2250,19 +2250,19 @@ else $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - + // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='propal_send'; $formmail->param['id']=$object->id; $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - - + + // Init list of files if (GETPOST("mode")=='init') { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index bdd61a6ace3..9b4a88592f3 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2390,7 +2390,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2413,7 +2413,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -2443,11 +2443,11 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_commande_external_CUSTOMER')) { @@ -2456,12 +2456,12 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - + // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='order_send'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 935d475bb9e..98f09c18351 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3138,7 +3138,7 @@ else if ($id > 0 || ! empty($ref)) { $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key]; } - + if ($action == 'edit_extras' && $user->rights->facture->creer) { print $extrafields->showInputField($key,$value); @@ -3511,7 +3511,7 @@ else if ($id > 0 || ! empty($ref)) $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -3534,7 +3534,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -3563,31 +3563,31 @@ else if ($id > 0 || ! empty($ref)) $formmail->substit['__FACREF__']=$object->ref; $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; - $formmail->substit['__CONTACTCIVNAME__']=''; - + $formmail->substit['__CONTACTCIVNAME__']=''; + //Find the good contact adress $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) { - + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; - + $contactstatic=new Contact($db); $contactstatic->fetch($contact['id']); $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - - + + // Tableau des parametres complementaires du post $formmail->param['action']=$action; $formmail->param['models']=$modelmail; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index d58b6d60f4f..0066b3ad485 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1405,7 +1405,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1428,7 +1428,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -1458,7 +1458,7 @@ else $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + //Find the good contact adress //Find the good contact adress if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) { @@ -1475,22 +1475,22 @@ else if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { - + if ($contact['libelle']==$langs->trans('TypeContact_commande_external_CUSTOMER')) { - + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; - + $contactstatic=new Contact($db); $contactstatic->fetch($contact['id']); $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - + // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='shipping_send'; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index f7371f42066..295298614b8 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1068,7 +1068,7 @@ else if ($id > 0 || ! empty($ref)) $numref = $object->ref; } $text=$langs->trans('ConfirmValidateIntervention',$numref); - + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',0,1); if ($ret == 'html') print '
'; } @@ -1465,7 +1465,7 @@ else if ($id > 0 || ! empty($ref)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1488,7 +1488,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -1519,12 +1519,12 @@ else if ($id > 0 || ! empty($ref)) $formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__PERSONALIZED__']=''; $formmail->substit['__CONTACTCIVNAME__']=''; - + //Find the good contact adress $custcontact=''; $contactarr=array(); $contactarr=$object->liste_contact(-1,'external'); - + if (is_array($contactarr) && count($contactarr)>0) { foreach($contactarr as $contact) { if ($contact['libelle']==$langs->trans('TypeContact_fichinter_external_CUSTOMER')) { @@ -1534,12 +1534,12 @@ else if ($id > 0 || ! empty($ref)) $custcontact=$contactstatic->getFullName($langs,1); } } - + if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__']=$custcontact; } } - + // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='fichinter_send'; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 856c92c88bf..6ba577c152b 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1855,7 +1855,7 @@ elseif (! empty($object->id)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1878,7 +1878,7 @@ elseif (! empty($object->id)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 8d33e97f499..9f63805a288 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -2071,7 +2071,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2094,7 +2094,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } From e0baa0fe46e53851f2f74a3be1fe77021b526c52 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 14:04:09 +0100 Subject: [PATCH 17/37] Generalize fix: file with a specific mask not found, again Conflicts: htdocs/comm/propal.php htdocs/commande/fiche.php htdocs/compta/facture.php htdocs/expedition/fiche.php htdocs/fichinter/fiche.php --- htdocs/comm/propal.php | 4 ++-- htdocs/commande/fiche.php | 4 ++-- htdocs/compta/facture.php | 2 +- htdocs/core/lib/files.lib.php | 6 +++--- htdocs/expedition/fiche.php | 6 +++--- htdocs/fichinter/fiche.php | 4 ++-- htdocs/fourn/commande/fiche.php | 4 ++-- htdocs/fourn/facture/fiche.php | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b6ef6d3f5b8..19d9f89cc48 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1851,7 +1851,7 @@ if ($action == 'presend') dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -1904,4 +1904,4 @@ if ($action == 'presend') // End of page llxFooter(); $db->close(); -?> +?> \ No newline at end of file diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 5b80bfadf9e..a1d1d173add 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2359,7 +2359,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2382,7 +2382,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 286204b52a2..a990149aa87 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3373,7 +3373,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index d083751d819..d5874b1d4d7 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -42,7 +42,7 @@ function dol_basename($pathfile) * @param string $path Starting path from which to search * @param string $types Can be "directories", "files", or "all" * @param int $recursive Determines whether subdirectories are searched - * @param string $filter Regex for include filter + * @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function * @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')) * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortorder Sort order (SORT_ASC, SORT_DESC) @@ -1237,8 +1237,8 @@ function dol_uncompress($inputfile,$outputdir) * Return most recent file * * @param string $dir Directory to scan - * @param string $regexfilter Regexfilter - * @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')) + * @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function + * @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function * @return strnig Full path to most recent file */ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$','^\.')) diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 7e9a24be0f9..9085aaa95ea 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1407,7 +1407,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1430,7 +1430,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } @@ -1491,4 +1491,4 @@ else llxFooter(); $db->close(); -?> \ No newline at end of file +?> diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 755b68b5af1..086b88fa032 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1451,7 +1451,7 @@ else if ($id > 0 || ! empty($ref)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1474,7 +1474,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 703e52f8652..ef3117dec78 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1785,7 +1785,7 @@ if (! empty($object->id)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1808,7 +1808,7 @@ if (! empty($object->id)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 4b332efcc64..468a5c91e79 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -2039,7 +2039,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2062,7 +2062,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); $file=$fileparams['fullname']; } From 89365786a823e0bda7266f0a3540c825ed82e009 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 14:27:13 +0100 Subject: [PATCH 18/37] New: enhance tool fixdosfiles.sh Convert DOS files to unix --- dev/finddosfiles.sh | 15 - dev/fixdosfiles.sh | 30 ++ dev/skeletons/skeleton_script.php | 4 +- htdocs/adherents/admin/adherent.php | 54 +- htdocs/adherents/card_subscriptions.php | 2 +- htdocs/adherents/index.php | 4 +- htdocs/admin/agenda.php | 4 +- htdocs/admin/agenda_extsites.php | 46 +- htdocs/admin/agenda_xcal.php | 4 +- htdocs/admin/const.php | 8 +- htdocs/admin/dict.php | 36 +- htdocs/admin/menus.php | 16 +- htdocs/admin/menus/index.php | 22 +- htdocs/admin/modules.php | 20 +- htdocs/admin/pdf.php | 26 +- htdocs/admin/tools/listevents.php | 10 +- htdocs/categories/index.php | 56 +-- htdocs/comm/action/rapport/index.php | 4 +- htdocs/comm/index.php | 6 +- htdocs/comm/mailing/fiche.php | 8 +- htdocs/comm/mailing/index.php | 8 +- htdocs/comm/propal/index.php | 6 +- htdocs/comm/prospect/index.php | 6 +- htdocs/commande/fiche.php | 18 +- htdocs/commande/index.php | 6 +- htdocs/compta/bank/rappro.php | 2 +- htdocs/compta/facture.php | 36 +- htdocs/compta/facture/impayees.php | 2 +- htdocs/compta/index.php | 6 +- htdocs/compta/paiement/cheque/index.php | 6 +- htdocs/compta/prelevement/index.php | 6 +- htdocs/compta/recap-compta.php | 4 +- htdocs/compta/ventilation/index.php | 6 +- htdocs/contrat/index.php | 10 +- .../core/class/commondocgenerator.class.php | 24 +- htdocs/core/class/commonobject.class.php | 16 +- htdocs/core/class/html.form.class.php | 22 +- htdocs/core/class/html.formfile.class.php | 6 +- htdocs/core/class/html.formother.class.php | 100 ++-- htdocs/core/getmenu_jmobile.php | 62 +-- htdocs/core/lib/company.lib.php | 10 +- htdocs/core/lib/functions.lib.php | 58 +-- htdocs/core/lib/treeview.lib.php | 4 +- htdocs/core/menus/standard/auguria.lib.php | 48 +- htdocs/core/menus/standard/auguria_menu.php | 198 ++++---- htdocs/core/menus/standard/eldy.lib.php | 26 +- htdocs/core/menus/standard/eldy_menu.php | 46 +- htdocs/core/menus/standard/empty.php | 46 +- .../doc/doc_generic_order_odt.modules.php | 18 +- .../modules/export/export_csv.modules.php | 2 +- .../modules/export/export_excel.modules.php | 24 +- .../export/export_excel2007.modules.php | 4 +- .../modules/export/export_tsv.modules.php | 2 +- .../doc/doc_generic_invoice_odt.modules.php | 2 +- .../modules/facture/doc/pdf_crabe.modules.php | 6 +- htdocs/core/modules/modCron.class.php | 24 +- htdocs/core/search_jmobile.php | 84 ++-- htdocs/cron/admin/cron.php | 18 +- htdocs/cron/card.php | 2 +- htdocs/expedition/index.php | 6 +- htdocs/exports/class/export.class.php | 2 +- htdocs/exports/export.php | 2 +- htdocs/filefunc.inc.php | 2 +- htdocs/fourn/index.php | 6 +- htdocs/holiday/class/holiday.class.php | 12 +- htdocs/holiday/define_holiday.php | 8 +- htdocs/holiday/index.php | 74 +-- htdocs/install/etape5.php | 4 +- htdocs/install/inc.php | 36 +- htdocs/install/upgrade.php | 40 +- htdocs/main.inc.php | 4 +- htdocs/master.inc.php | 4 +- htdocs/product/index.php | 6 +- htdocs/product/stock/index.php | 6 +- htdocs/public/paybox/paymentko.php | 6 +- htdocs/public/paybox/paymentok.php | 6 +- htdocs/public/paypal/paymentko.php | 6 +- htdocs/societe/class/societe.class.php | 6 +- htdocs/societe/consumption.php | 248 +++++----- htdocs/societe/index.php | 4 +- htdocs/theme/bureau2crea/style.css.php | 2 +- htdocs/theme/eldy/style.css.php | 2 +- .../theme/phones/smartphone/tpl/menu.tpl.php | 16 +- htdocs/user/class/user.class.php | 408 ++++++++-------- htdocs/user/fiche.php | 72 +-- htdocs/user/hierarchy.php | 92 ++-- htdocs/user/home.php | 6 +- htdocs/webservices/server_invoice.php | 12 +- htdocs/webservices/server_order.php | 46 +- .../webservices/server_productorservice.php | 10 +- scripts/cron/cron_run_jobs.php | 40 +- ...ail_unpaid_invoices_to_representatives.php | 18 +- test/phpunit/AllTests.php | 16 +- test/phpunit/ContactTest.php | 8 +- test/phpunit/CoreTest.php | 8 +- test/phpunit/WebservicesInvoicesTest.php | 114 ++--- test/phpunit/WebservicesOrdersTest.php | 462 +++++++++--------- test/phpunit/WebservicesOtherTest.php | 116 ++--- test/phpunit/WebservicesThirdpartyTest.php | 118 ++--- test/phpunit/WebservicesUserTest.php | 116 ++--- 100 files changed, 1767 insertions(+), 1752 deletions(-) delete mode 100755 dev/finddosfiles.sh create mode 100755 dev/fixdosfiles.sh diff --git a/dev/finddosfiles.sh b/dev/finddosfiles.sh deleted file mode 100755 index f77859ba1ea..00000000000 --- a/dev/finddosfiles.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -#------------------------------------------------------ -# Script to find files that are not Unix encoded -# -# Laurent Destailleur - eldy@users.sourceforge.net -#------------------------------------------------------ -# Usage: finddosfiles.sh -#------------------------------------------------------ - -# To detec -find . -type f -iname "*.php" -exec file "{}" + | grep CRLF - -# To convert -#find . -type f -iname "*.php" -exec dos2unix "{}" +; - diff --git a/dev/fixdosfiles.sh b/dev/fixdosfiles.sh new file mode 100755 index 00000000000..da1e1a12af5 --- /dev/null +++ b/dev/fixdosfiles.sh @@ -0,0 +1,30 @@ +#!/bin/sh +#------------------------------------------------------ +# Script to find files that are not Unix encoded +# +# Laurent Destailleur - eldy@users.sourceforge.net +#------------------------------------------------------ +# Usage: fixdosfiles.sh [list|fix] +#------------------------------------------------------ + +# Syntax +if [ "x$1" != "xlist" -a "x$1" != "xfix" ] +then + echo "Usage: fixdosfiles.sh [list|fix]" +fi + +# To detec +if [ "x$1" = "xlist" ] +then + find . -type f -iname "*.php" -exec file "{}" + | grep CRLF +fi + +# To convert +if [ "x$1" = "xfix" ] +then + for fic in `find . -type f -iname "*.php" -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' ` + do + echo "Fix file $fic" + dos2unix $fic + done; +fi diff --git a/dev/skeletons/skeleton_script.php b/dev/skeletons/skeleton_script.php index 38a68a73ed3..083e7ef680b 100644 --- a/dev/skeletons/skeleton_script.php +++ b/dev/skeletons/skeleton_script.php @@ -40,8 +40,8 @@ $error=0; // -------------------- START OF YOUR CODE HERE -------------------- -@set_time_limit(0); // No timeout for this script -define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". +@set_time_limit(0); // No timeout for this script +define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". // Include and load Dolibarr environment variables require_once($path."../../htdocs/master.inc.php"); diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 62f89f992dd..2bed305783a 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -169,7 +169,7 @@ print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_DEFAULT_S print ''; print ''; print "\n"; -print ''; +print ''; // Insert subscription into bank account $var=!$var; @@ -179,41 +179,41 @@ print ''; print ''; print ''.$langs->trans("MoreActionsOnSubscription").''; $arraychoices=array('0'=>$langs->trans("None")); -if (! empty($conf->banque->enabled)) $arraychoices['bankdirect']=$langs->trans("MoreActionBankDirect"); -if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['invoiceonly']=$langs->trans("MoreActionInvoiceOnly"); -if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice"); +if (! empty($conf->banque->enabled)) $arraychoices['bankdirect']=$langs->trans("MoreActionBankDirect"); +if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['invoiceonly']=$langs->trans("MoreActionInvoiceOnly"); +if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice"); print ''; print $form->selectarray('constvalue',$arraychoices,$conf->global->ADHERENT_BANK_USE,0); print ''; print ''; print ''; print "\n"; -print ''; +print ''; -// Use vat for invoice creation +// Use vat for invoice creation if ($conf->facture->enabled) { - $var=!$var; - print '
'; - print ''; - print ''; - print ''; - print ''.$langs->trans("VATToUseForSubscriptions").''; - if (! empty($conf->banque->enabled)) - { - print ''; - print $form->selectarray('constvalue', array('0'=>$langs->trans("NoVatOnSubscription"),'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS)?'0':$conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); - print ''; - print ''; - print ''; - } - else - { - print ''; - print $langs->trans("WarningModuleNotActive",$langs->transnoentities("Module85Name")); - print ''; - } - print "\n"; + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''.$langs->trans("VATToUseForSubscriptions").''; + if (! empty($conf->banque->enabled)) + { + print ''; + print $form->selectarray('constvalue', array('0'=>$langs->trans("NoVatOnSubscription"),'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS)?'0':$conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); + print ''; + print ''; + print ''; + } + else + { + print ''; + print $langs->trans("WarningModuleNotActive",$langs->transnoentities("Module85Name")); + print ''; + } + print "\n"; print '
'; } diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 279669497ec..bed822274ed 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -362,7 +362,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ // Add line to draft invoice $idprodsubscription=0; - $vattouse=0; + $vattouse=0; if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry') { $vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index e3787b18c89..fc5994f3086 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -197,7 +197,7 @@ if ($conf->use_javascript_ajax) //print ''; -print '
'; +print '
'; $var=true; @@ -419,7 +419,7 @@ print "\n"; print "
\n"; //print ''; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 29af716ceb0..7eb659bde97 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -139,9 +139,9 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'autoactions', $langs->trans("Agenda")); -print $langs->trans("AgendaAutoActionDesc")."
\n"; +print $langs->trans("AgendaAutoActionDesc")."
\n"; print $langs->trans("OnlyActiveElementsAreShown").'
'; -print "
\n"; +print "
\n"; print '
'; print ''; diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 5d4c787bf37..d23d7c510ea 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -64,8 +64,8 @@ if ($actionsave) { $name=trim(GETPOST('agenda_ext_name'.$i),'alpha'); $src=trim(GETPOST('agenda_ext_src'.$i,'alpha')); - $color=trim(GETPOST('agenda_ext_color'.$i,'alpha')); - if ($color=='-1') $color=''; + $color=trim(GETPOST('agenda_ext_color'.$i,'alpha')); + if ($color=='-1') $color=''; if (! empty($src) && ! preg_match('/^(http\s*|ftp\s*):/', $src)) { @@ -148,32 +148,32 @@ $var=!$var; print ""; print "".$langs->trans("ExtSitesEnableThisTool").""; print ''; -if ($conf->use_javascript_ajax) -{ - print ajax_constantonoff('AGENDA_DISABLE_EXT',array('enabled'=>array(0=>'.hideifnotset')),null,1); -} -else -{ - if($conf->global->AGENDA_DISABLE_EXT == 0) - { - print ''.img_picto($langs->trans("Enabled"),'on').''; - } - else - { - print ''.img_picto($langs->trans("Disabled"),'off').''; - } -} +if ($conf->use_javascript_ajax) +{ + print ajax_constantonoff('AGENDA_DISABLE_EXT',array('enabled'=>array(0=>'.hideifnotset')),null,1); +} +else +{ + if($conf->global->AGENDA_DISABLE_EXT == 0) + { + print ''.img_picto($langs->trans("Enabled"),'on').''; + } + else + { + print ''.img_picto($langs->trans("Disabled"),'off').''; + } +} print ""; print ""; // Nb of agenda $var=!$var; -print ""; -print "".$langs->trans("ExtSitesNbOfAgenda").""; -print ''; -print ''; -print ""; -print ""; +print ""; +print "".$langs->trans("ExtSitesNbOfAgenda").""; +print ''; +print ''; +print ""; +print ""; print ""; print "
"; diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 64e03fe7f9c..2aa5992b5af 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -80,8 +80,8 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'xcal', $langs->trans("Agenda")); -print $langs->trans("AgendaSetupOtherDesc")."
\n"; -print "
\n"; +print $langs->trans("AgendaSetupOtherDesc")."
\n"; +print "
\n"; print ''; print ''; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index a2b07ca2d11..a2838ae7fe9 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -122,7 +122,7 @@ if (! empty($consts) && $action == 'delete') } } if ($nbdeleted > 0) setEventMessage($langs->trans("RecordDeleted")); - $action=''; + $action=''; } // Delete line from delete picto @@ -130,7 +130,7 @@ if ($action == 'delete') { if (dolibarr_del_const($db, $rowid, $entity) >= 0) { - setEventMessage($langs->trans("RecordDeleted")); + setEventMessage($langs->trans("RecordDeleted")); } else { @@ -222,8 +222,8 @@ print '
'; print "\n"; print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; -print ''; -print ''; +print ''; +print ''; // Show constants $sql = "SELECT"; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 21f6195525d..4df22736021 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -125,8 +125,8 @@ $tablib[20]= "DictionnaryOrderMethods"; $tablib[21]= "DictionnaryAvailability"; $tablib[22]= "DictionnarySource"; $tablib[23]= "DictionnaryAccountancyplan"; -$tablib[24]= "DictionnaryAccountancysystem"; -$tablib[25]= "DictionnaryRevenueStamp"; +$tablib[24]= "DictionnaryAccountancysystem"; +$tablib[25]= "DictionnaryRevenueStamp"; // Requete pour extraction des donnees des dictionnaires $tabsql=array(); @@ -153,8 +153,8 @@ $tabsql[20]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREF $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c"; $tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[23]= "SELECT rowid as rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number as accountancy_code, account_parent, label, active FROM ".MAIN_DB_PREFIX."accountingaccount"; -$tabsql[24]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, p.code as country_code, p.libelle as pays, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_pays as p WHERE s.fk_pays=p.rowid and p.active=1"; -$tabsql[25]= "SELECT t.rowid, t.taux, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; +$tabsql[24]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, p.code as country_code, p.libelle as pays, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_pays as p WHERE s.fk_pays=p.rowid and p.active=1"; +$tabsql[25]= "SELECT t.rowid, t.taux, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; // Critere de tri du dictionnaire $tabsqlsort=array(); @@ -181,8 +181,8 @@ $tabsqlsort[20]="code ASC, libelle ASC"; $tabsqlsort[21]="code ASC, label ASC"; $tabsqlsort[22]="code ASC, label ASC"; $tabsqlsort[23]="fk_pcg_version ASC, accountancy_code ASC"; -$tabsqlsort[24]="pcg_version ASC"; -$tabsqlsort[25]="country ASC, taux ASC"; +$tabsqlsort[24]="pcg_version ASC"; +$tabsqlsort[25]="country ASC, taux ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield=array(); @@ -209,8 +209,8 @@ $tabfield[20]= "code,libelle"; $tabfield[21]= "code,label"; $tabfield[22]= "code,label"; $tabfield[23]= "fk_pcg_version,accountancy_code,account_parent,pcg_type,pcg_subtype,label"; -$tabfield[24]= "pcg_version,country_id,country,label"; -$tabfield[25]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note"; +$tabfield[24]= "pcg_version,country_id,country,label"; +$tabfield[25]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note"; // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue=array(); @@ -237,8 +237,8 @@ $tabfieldvalue[20]= "code,libelle"; $tabfieldvalue[21]= "code,label"; $tabfieldvalue[22]= "code,label"; $tabfieldvalue[23]= "fk_pcg_version,accountancy_code,account_parent,pcg_type,pcg_subtype,label"; -$tabfieldvalue[24]= "pcg_version,country,label"; -$tabfieldvalue[25]= "country,taux,accountancy_code_sell,accountancy_code_buy,note"; +$tabfieldvalue[24]= "pcg_version,country,label"; +$tabfieldvalue[25]= "country,taux,accountancy_code_sell,accountancy_code_buy,note"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert=array(); @@ -265,8 +265,8 @@ $tabfieldinsert[20]= "code,libelle"; $tabfieldinsert[21]= "code,label"; $tabfieldinsert[22]= "code,label"; $tabfieldinsert[23]= "fk_pcg_version,account_number,account_parent,pcg_type,pcg_subtype,label"; -$tabfieldinsert[24]= "pcg_version,fk_pays,label"; -$tabfieldinsert[25]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note"; +$tabfieldinsert[24]= "pcg_version,fk_pays,label"; +$tabfieldinsert[25]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note"; // Nom du rowid si le champ n'est pas de type autoincrement // Example: "" if id field is "rowid" and has autoincrement on @@ -295,8 +295,8 @@ $tabrowid[20]= ""; $tabrowid[21]= "rowid"; $tabrowid[22]= "rowid"; $tabrowid[23]= ""; -$tabrowid[24]= ""; -$tabrowid[25]= ""; +$tabrowid[24]= ""; +$tabrowid[25]= ""; // Condition to show dictionnary in setup page $tabcond=array(); @@ -323,8 +323,8 @@ $tabcond[20]= ! empty($conf->fournisseur->enabled); $tabcond[21]= ! empty($conf->propal->enabled); $tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled)); $tabcond[23]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy plan should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor. -$tabcond[24]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy system should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor. -$tabcond[25]= true; +$tabcond[24]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy system should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor. +$tabcond[25]= true; // List of help for fields $tabhelp=array(); @@ -351,8 +351,8 @@ $tabhelp[20] = array(); $tabhelp[21] = array(); $tabhelp[22] = array(); $tabhelp[23] = array(); -$tabhelp[24] = array(); -$tabhelp[25] = array(); +$tabhelp[24] = array(); +$tabhelp[25] = array(); // Complete all arrays with entries found into modules complete_dictionnary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp); diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index bd5074f01b1..5974de1decc 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -77,21 +77,21 @@ if ($action == 'update' && empty($_POST["cancel"])) // Define list of menu handlers to initialize $listofmenuhandler=array(); - $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_STANDARD"])]=1; - $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_STANDARD"])]=1; - if (isset($_POST["MAIN_MENU_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_SMARTPHONE"])]=1; - if (isset($_POST["MAIN_MENUFRONT_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_SMARTPHONE"])]=1; + $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_STANDARD"])]=1; + $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_STANDARD"])]=1; + if (isset($_POST["MAIN_MENU_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_SMARTPHONE"])]=1; + if (isset($_POST["MAIN_MENUFRONT_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_SMARTPHONE"])]=1; // Initialize menu handlers foreach ($listofmenuhandler as $key => $val) { // Load sql init_menu_handler.sql file - $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); - foreach($dirmenus as $dirmenu) - { + $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); + foreach($dirmenus as $dirmenu) + { $file='init_menu_'.$key.'.sql'; $fullpath=dol_buildpath($dirmenu.$file); - //print 'action='.$action.' Search menu into fullpath='.$fullpath.'
';exit; + //print 'action='.$action.' Search menu into fullpath='.$fullpath.'
';exit; if (file_exists($fullpath)) { diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 092e910c5cc..fa30f472a5c 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -57,7 +57,7 @@ $menu_handler=$menu_handler_top; if (GETPOST("handler_origine")) $menu_handler=GETPOST("handler_origine"); if (GETPOST("menu_handler")) $menu_handler=GETPOST("menu_handler"); -$menu_handler_to_search=preg_replace('/(_backoffice|_frontoffice|_menu)?(\.php)?/i','',$menu_handler); +$menu_handler_to_search=preg_replace('/(_backoffice|_frontoffice|_menu)?(\.php)?/i','',$menu_handler); /* @@ -207,8 +207,8 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes') $form=new Form($db); $formadmin=new FormAdmin($db); -$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); -$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); +$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); +$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); llxHeader('',$langs->trans("Menus"),'','',0,0,$arrayofjs,$arrayofcss); @@ -324,14 +324,14 @@ if ($conf->use_javascript_ajax) 'leftmenu'=>$menu['leftmenu'], 'fk_mainmenu'=>$menu['fk_mainmenu'], 'fk_leftmenu'=>$menu['fk_leftmenu'], - 'entry'=>'
'. - '   '.$titre.''. - ''. - ''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. - ''.img_edit_add('default',0,'class="menuNew" id="new'.$menu['rowid'].'"').' '. - ''.img_delete('default',0,'class="menuDel" id="del'.$menu['rowid'].'"').' '. - ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. - '
' + 'entry'=>'
'. + '   '.$titre.''. + ''. + ''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. + ''.img_edit_add('default',0,'class="menuNew" id="new'.$menu['rowid'].'"').' '. + ''.img_delete('default',0,'class="menuDel" id="del'.$menu['rowid'].'"').' '. + ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. + '
' ); $i++; } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index cbe59807a26..4440d632b2e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -197,14 +197,14 @@ $moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1 print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'setup'); -// Start to show page -if (empty($mode)) $mode='common'; -if ($mode==='common') print $langs->trans("ModulesDesc")."
\n"; -if ($mode==='other') print $langs->trans("ModulesSpecialDesc")."
\n"; -if ($mode==='interfaces') print $langs->trans("ModulesInterfaceDesc")."
\n"; -if ($mode==='functional') print $langs->trans("ModulesJobDesc")."
\n"; -if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."
\n"; -if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."
\n"; +// Start to show page +if (empty($mode)) $mode='common'; +if ($mode==='common') print $langs->trans("ModulesDesc")."
\n"; +if ($mode==='other') print $langs->trans("ModulesSpecialDesc")."
\n"; +if ($mode==='interfaces') print $langs->trans("ModulesInterfaceDesc")."
\n"; +if ($mode==='functional') print $langs->trans("ModulesJobDesc")."
\n"; +if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."
\n"; +if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."
\n"; if ($nbofactivatedmodules <= 1) print ' '.img_warning($langs->trans("YouMustEnableOneModule")); //print '
'."\n"; @@ -499,8 +499,8 @@ else dol_fiche_end(); -// Show warning about external users -if ($mode != 'marketplace') print showModulesExludedForExternal($modules).'
'."\n"; +// Show warning about external users +if ($mode != 'marketplace') print showModulesExludedForExternal($modules).'
'."\n"; llxFooter(); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 5617ecc1dfb..afa67c434e8 100755 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -68,19 +68,19 @@ if ($action == 'update') exit; } -if ($action == 'activate_pdfsecurity') -{ - dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1",'chaine',0,'',$conf->entity); - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} -else if ($action == 'disable_pdfsecurity') -{ - dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity); - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); - exit; -} - +if ($action == 'activate_pdfsecurity') +{ + dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1",'chaine',0,'',$conf->entity); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} +else if ($action == 'disable_pdfsecurity') +{ + dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); + exit; +} + /* diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 8056080be23..284520bce48 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -139,11 +139,11 @@ if ($result) $i = 0; $param=''; - if ($search_code) $param.='&search_code='.$search_code; - if ($search_ip) $param.='&search_ip='.$search_ip; - if ($search_user) $param.='&search_user='.$search_user; - if ($search_desc) $param.='&search_desc='.$search_desc; - if ($search_ua) $param.='&search_ua='.$search_ua; + if ($search_code) $param.='&search_code='.$search_code; + if ($search_ip) $param.='&search_ip='.$search_ip; + if ($search_user) $param.='&search_user='.$search_user; + if ($search_desc) $param.='&search_desc='.$search_desc; + if ($search_ua) $param.='&search_ua='.$search_ua; print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup'); diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 532a95f7317..aeed1760f00 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -62,7 +62,7 @@ print_fiche_titre($title); //print ''; //print '
'; -print '
'; +print '
'; /* @@ -91,7 +91,7 @@ print '
'; //print ''; -print '
'; +print '
'; /* @@ -136,25 +136,25 @@ $cate_arbo = $categstatic->get_full_arbo($type); $fulltree=$cate_arbo; // Define data (format for treeview) -$data=array(); -$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); -foreach($fulltree as $key => $val) +$data=array(); +$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); +foreach($fulltree as $key => $val) { - $categstatic->id=$val['id']; - $categstatic->ref=$val['label']; - $categstatic->type=$type; - $li=$categstatic->getNomUrl(1,'',60); + $categstatic->id=$val['id']; + $categstatic->ref=$val['label']; + $categstatic->type=$type; + $li=$categstatic->getNomUrl(1,'',60); - $data[] = array( - 'rowid'=>$val['rowid'], - 'fk_menu'=>$val['fk_parent'], - 'entry'=>''. + '
'.$li. - ''. + $data[] = array( + 'rowid'=>$val['rowid'], + 'fk_menu'=>$val['fk_parent'], + 'entry'=>''. - ''. - '
'.$li. + ''. ' '.$val['description'].''.img_view().'
' - ); -} + '
'.img_view().'
' + ); +} print ''; @@ -170,20 +170,20 @@ $nbofentries=(count($data) - 1); if ($nbofentries > 0) { print ''; } else { - print ''; - print ''; - print ''; -} + print ''; + print ''; + print ''; +} print "
'; - tree_recur($data,$data[0],0); + tree_recur($data,$data[0],0); print '
'; - print ''; - print ''; - print '
'.img_picto_common('','treemenu/branchbottom.gif').''; - print $langs->trans("NoCategoryYet"); - print ' 
'; + print ''; + print ''; + print '
'.img_picto_common('','treemenu/branchbottom.gif').''; + print $langs->trans("NoCategoryYet"); + print ' 
"; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 9d82fb21ab9..33a30e9c6b6 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -30,8 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/action/rapport.pdf.php'; -$langs->load("agenda"); -$langs->load("commercial"); +$langs->load("agenda"); +$langs->load("commercial"); $action=GETPOST('action','alpha'); $month=GETPOST('month'); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index c30d75192d8..d3acdd87593 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -87,7 +87,7 @@ llxHeader(); print_fiche_titre($langs->trans("CustomerArea")); -print '
'; +print '
'; /* print ''; print ''; @@ -270,7 +270,7 @@ else { print '
'; }*/ -print '
'; +print '
'; $NBMAX=3; @@ -546,7 +546,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index d04b9c7aefe..564daaaaa74 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -1017,9 +1017,9 @@ else print ''; if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') { - // Editeur wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_readonly','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,70); + // Editeur wysiwyg + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_readonly','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,70); $doleditor->Create(); } else print dol_htmlentitiesbr($object->body); @@ -1055,7 +1055,7 @@ else print ''; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; - $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' '.$langs->trans("NoTargetYet").''); + $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' '.$langs->trans("NoTargetYet").''); if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index b2ff4d92f76..fd12402f050 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -46,7 +46,7 @@ print_fiche_titre($langs->trans("MailingArea")); //print ''; //print '
'; -print '
'; +print '
'; // Recherche emails @@ -143,7 +143,7 @@ print "

"; //print ''; -print '
'; +print '
'; /* @@ -201,7 +201,7 @@ else //print ''; -print '
'; +print '
'; if ($langs->file_exists("html/spam.html",0)) { @@ -216,5 +216,5 @@ if ($langs->file_exists("html/spam.html",0)) { llxFooter(); -$db->close(); +$db->close(); ?> diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 4ac166b54a2..6347f68c87a 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -56,7 +56,7 @@ print_fiche_titre($langs->trans("ProspectionArea")); //print ''; //print '
'; -print '
'; +print '
'; /* @@ -202,7 +202,7 @@ if (! empty($conf->propal->enabled)) //print '
'; -print '
'; +print '
'; $max=5; @@ -513,7 +513,7 @@ if (! empty($conf->propal->enabled)) */ //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index bf53b674bc5..e08228b5c61 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -48,7 +48,7 @@ print_fiche_titre($langs->trans("ProspectionArea")); //print ''; //print '
'; -print '
'; +print '
'; if (! empty($conf->propal->enabled)) @@ -161,7 +161,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) //print '
'; -print '
'; +print '
'; /* @@ -279,7 +279,7 @@ if ($resql) //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 9b4a88592f3..4bf473d3413 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -657,15 +657,15 @@ else if ($action == 'addline' && $user->rights->commande->creer) $desc=dol_concatdesc($desc,$product_desc); - // Add custom code and origin country into description - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) - { - $tmptxt='('; - if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; - if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); - $tmptxt.=')'; - $desc= dol_concatdesc($desc, $tmptxt); + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) + { + $tmptxt='('; + if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; + if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); + $tmptxt.=')'; + $desc= dol_concatdesc($desc, $tmptxt); } } diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 3301721df7a..cb6e85ac117 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -57,7 +57,7 @@ print_fiche_titre($langs->trans("OrdersArea")); //print ''; //print '
'; -print '
'; +print '
'; /* @@ -207,7 +207,7 @@ if (! empty($conf->commande->enabled)) //print '
'; -print '
'; +print '
'; $max=5; @@ -425,7 +425,7 @@ if (! empty($conf->commande->enabled)) //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index d631e8e1843..4e8b717201c 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -443,7 +443,7 @@ if ($resql) print "
\n"; - print '

'; + print '

'; print "\n"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 98f09c18351..2ba0ce6e137 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2283,7 +2283,7 @@ else if ($id > 0 || ! empty($ref)) $soc = new Societe($db); $soc->fetch($object->socid); - $selleruserevenustamp=$mysoc->useRevenueStamp(); + $selleruserevenustamp=$mysoc->useRevenueStamp(); $totalpaye = $object->getSommePaiement(); $totalcreditnotes = $object->getSumCreditNotesUsed(); @@ -2754,7 +2754,7 @@ else if ($id > 0 || ! empty($ref)) if (! empty($conf->banque->enabled)) $nbcols++; if($mysoc->localtax1_assuj=="1") $nbrows++; if($mysoc->localtax2_assuj=="1") $nbrows++; - if ($selleruserevenustamp) $nbrows++; + if ($selleruserevenustamp) $nbrows++; print ''; @@ -3043,16 +3043,16 @@ else if ($id > 0 || ! empty($ref)) // Revenue stamp if ($selleruserevenustamp) // Test company use revenue stamp - { - print ''; - print ''; - if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('RevenueStamp'); - print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'),1).'
'; - print ''; - if ($action == 'editrevenuestamp') - { + { + print ''; + print ''; + if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + print '
'; + print $langs->trans('RevenueStamp'); + print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'),1).'
'; + print ''; + if ($action == 'editrevenuestamp') + { print '
'; print ''; print ''; @@ -3060,12 +3060,12 @@ else if ($id > 0 || ! empty($ref)) //print ''; print ' '; print '
'; - } - else - { - print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency); - } - print ''; + } + else + { + print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency); + } + print ''; } // Total with tax diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 086b9a35fc4..240ad867358 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -377,7 +377,7 @@ if ($resql) print ''; $cn=$facturestatic->getSumCreditNotesUsed(); if (! empty($objp->am)) print price($objp->am); - if (! empty($objp->am) && ! empty($cn)) print '+'; + if (! empty($objp->am) && ! empty($cn)) print '+'; if (! empty($cn)) print price($cn); print ''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index d4aad86977e..925e55f02fc 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -106,7 +106,7 @@ print_fiche_titre($langs->trans("AccountancyTreasuryArea")); //print ''; //print '
'; -print '
'; +print '
'; $max=3; @@ -324,7 +324,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- //print '
'; -print '
'; +print '
'; // Last modified customer invoices @@ -1033,7 +1033,7 @@ if ($resql) } //print '
'; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 45a1f665a37..ac67e103a82 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -48,7 +48,7 @@ print_fiche_titre($langs->trans("ChequesArea")); //print ''; //print '
'; -print '
'; +print '
'; $sql = "SELECT count(b.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -87,7 +87,7 @@ else //print '
'; -print '
'; +print '
'; $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.number as ref"; @@ -146,7 +146,7 @@ else //print "
\n"; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 5fdd334db55..916c3fccec5 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -63,7 +63,7 @@ print_fiche_titre($langs->trans("CustomersStandingOrdersArea")); //print ''; //print '
'; -print '
'; +print '
'; $thirdpartystatic=new Societe($db); @@ -88,7 +88,7 @@ print '

'; //print ''; -print '
'; +print '
'; /* @@ -221,7 +221,7 @@ else //print ''; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index bc89cf7de7e..0cc7e2008e6 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -189,8 +189,8 @@ if ($socid > 0) print ''.price($solde)."\n"; // Author - $userstatic->id=$objp->userid; - $userstatic->login=$objp->login; + $userstatic->id=$objp->userid; + $userstatic->login=$objp->login; print ''; print $userstatic->getLoginUrl(1); print ''; diff --git a/htdocs/compta/ventilation/index.php b/htdocs/compta/ventilation/index.php index d01d1735734..316f5c41e1e 100644 --- a/htdocs/compta/ventilation/index.php +++ b/htdocs/compta/ventilation/index.php @@ -34,7 +34,7 @@ print_fiche_titre("Ventilation Comptable"); //print ''; //print '
'; -print '
'; +print '
'; $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql.= " , ".MAIN_DB_PREFIX."facture as f"; @@ -62,7 +62,7 @@ print "
\n"; //print ''; -print '
'; +print '
'; print ''; @@ -94,7 +94,7 @@ if ($resql) print "
\n"; //print ''; -print '
'; +print '
'; llxFooter(); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 88220fa7e29..bd35af4d55b 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -66,9 +66,9 @@ llxHeader(); print_fiche_titre($langs->trans("ContractsArea")); -//print ''; -//print '
'; -print '
'; +//print ''; +//print ''; print ''."\n"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 88efcfd76b5..d94fcab199d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -139,7 +139,7 @@ function analyse_sql_and_script(&$var, $type) // Check consitency of NOREQUIREXXX DEFINES -if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIREMENU')) dol_print_error('','If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not use them'); +if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIREMENU')) dol_print_error('','If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not use them'); // Sanity check on URL if (! empty($_SERVER["PHP_SELF"])) @@ -761,7 +761,7 @@ else $heightforframes=52; // Switch to another entity -// TODO Multicompany Remove this +// TODO Multicompany Remove this if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity') { if ($mc->switchEntity(GETPOST('entity','int')) > 0) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 36f85c9524e..7212ea38f5b 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -76,7 +76,7 @@ if (! empty($dolibarr_main_document_root_alt)) } // Set properties specific to multicompany -// TODO Multicompany Remove this. Useless. Var should be read when required. +// TODO Multicompany Remove this. Useless. Var should be read when required. $conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode; // Force Multi-Company transverse mode $conf->multicompany->force_entity = empty($multicompany_force_entity)?'':(int) $multicompany_force_entity; // Force entity in login page @@ -143,7 +143,7 @@ if (! defined('NOREQUIREDB')) { $conf->entity = DOLENTITY; } - // TODO Multicompany Remove this. + // TODO Multicompany Remove this. else if (! empty($conf->multicompany->force_entity) && is_int($conf->multicompany->force_entity)) // To force entity in login page { $conf->entity = $conf->multicompany->force_entity; diff --git a/htdocs/product/index.php b/htdocs/product/index.php index f0ab56ae6f0..8e3c3e795fd 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -69,7 +69,7 @@ print_fiche_titre($transAreaType); //print '
'; +print '
'; // Search contract @@ -286,8 +286,8 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) } -//print '
'; -print '
'; +//print '
'; +print '
'; // Last modified contracts diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 36eb166f499..0f4264b223f 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -197,25 +197,25 @@ abstract class CommonDocGenerator } - /** - * Define array with couple subtitution key => subtitution value - * - * @param Translate $outputlangs Language object for output - * @return array Array of substitution key->code - */ - function get_substitutionarray_other($outputlangs) - { - global $conf; + /** + * Define array with couple subtitution key => subtitution value + * + * @param Translate $outputlangs Language object for output + * @return array Array of substitution key->code + */ + function get_substitutionarray_other($outputlangs) + { + global $conf; $now=dol_now('gmt'); // gmt - $array_other = array( + $array_other = array( 'current_date'=>dol_print_date($now,'day','tzuser'), 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), 'current_server_date'=>dol_print_date($now,'day','tzserver'), 'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'), - ); + ); - return $array_other; + return $array_other; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b128455b8ff..4f7ce047d9b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1556,8 +1556,8 @@ abstract class CommonObject $i++; } - // Add revenue stamp to total - $this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0; + // Add revenue stamp to total + $this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0; $this->db->free($resql); @@ -2720,12 +2720,12 @@ abstract class CommonObject // Product if ($line->fk_product > 0) { - $product_static = new Product($this->db); - - $product_static->type=$line->fk_product_type; - $product_static->id=$line->fk_product; - $product_static->ref=$line->ref; - $text=$product_static->getNomUrl(1); + $product_static = new Product($this->db); + + $product_static->type=$line->fk_product_type; + $product_static->id=$line->fk_product; + $product_static->ref=$line->ref; + $text=$product_static->getNomUrl(1); // Define output language (TODO Does this works ?) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4807ec768fa..7d7713b297c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -691,19 +691,19 @@ class Form //$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); $out.= ajax_combobox($htmlname, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); /* - if ($selected && empty($selected_input_value)) - { - require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $product = new Product($this->db); - $product->fetch($selected); - $selected_input_value=$product->ref; - } + if ($selected && empty($selected_input_value)) + { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $product = new Product($this->db); + $product->fetch($selected); + $selected_input_value=$product->ref; + } // mode=1 means customers products - $ajaxoptions=array(); - $urloption='htmlname='.$htmlname.'&outjson=1&filter='.urlencode($filter).'&showtype='.$showtype; - $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); + $ajaxoptions=array(); + $urloption='htmlname='.$htmlname.'&outjson=1&filter='.urlencode($filter).'&showtype='.$showtype; + $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); $out.=''; - */ + */ } $out.= ''; - $num = $this->db->num_rows($resql); - $i = 0; - $out.=''."\n"; - if ($num) - { - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - if (($selected && $selected == $obj->taux) || $num == 1) - { - $out.=''; - $i++; - } - } - $out.=''; - return $out; - } - else - { - dol_print_error($this->db); - return ''; - } + $sql = "SELECT r.taux"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_pays as p"; + $sql.= " WHERE r.active = 1 AND r.fk_pays = p.rowid"; + $sql.= " AND p.code = '".$country_code."'"; + + dol_syslog(get_class($this).'::select_revenue_stamp sql='.$sql); + $resql=$this->db->query($sql); + if ($resql) + { + $out.=''; + return $out; + } + else + { + dol_print_error($this->db); + return ''; + } } diff --git a/htdocs/core/getmenu_jmobile.php b/htdocs/core/getmenu_jmobile.php index f7eaada8283..4075bbc77b6 100644 --- a/htdocs/core/getmenu_jmobile.php +++ b/htdocs/core/getmenu_jmobile.php @@ -51,42 +51,42 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); */ // URL http://mydolibarr/core/getmenu_jmobime?mainmenu=mainmenu&leftmenu=leftmenu can be used for tests -$arrayofjs=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js'); +$arrayofjs=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js'); $arrayofcss=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css'); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); print ''."\n"; -if (empty($user->societe_id)) // If internal user or not defined -{ - $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED); - $conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED); -} -else // If external user -{ - $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED); - $conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED); -} - -// Load the menu manager (only if not already done) -$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu; -if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php -if (! class_exists('MenuManager')) -{ - $menufound=0; - $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); - foreach($dirmenus as $dirmenu) - { - $menufound=dol_include_once($dirmenu."standard/".$file_menu); - if ($menufound) break; - } - if (! $menufound) // If failed to include, we try with standard - { - dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING); - $file_menu='eldy_menu.php'; - include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu; - } -} +if (empty($user->societe_id)) // If internal user or not defined +{ + $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED); + $conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED); +} +else // If external user +{ + $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED); + $conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED); +} + +// Load the menu manager (only if not already done) +$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu; +if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php +if (! class_exists('MenuManager')) +{ + $menufound=0; + $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); + foreach($dirmenus as $dirmenu) + { + $menufound=dol_include_once($dirmenu."standard/".$file_menu); + if ($menufound) break; + } + if (! $menufound) // If failed to include, we try with standard + { + dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING); + $file_menu='eldy_menu.php'; + include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu; + } +} $menumanager = new MenuManager($db, empty($user->societe_id)?0:1); $menumanager->loadMenu(); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index b7d012cc51a..9b74e999fbe 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -90,11 +90,11 @@ function societe_prepare_head($object) $head[$h][2] = 'note'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Referers"); - $head[$h][2] = 'consumption'; - $h++; - + $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; + $head[$h][1] = $langs->trans("Referers"); + $head[$h][2] = 'consumption'; + $h++; + // Attached files $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; $head[$h][1] = $langs->trans("Documents"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index edc39c6d164..d0ad263d71a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2630,9 +2630,9 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou { $listofcurrenciesbefore=array('USD'); if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code); - else $cursymbolafter.=$outlangs->getCurrencySymbol($currency_code); + else $cursymbolafter.=$outlangs->getCurrencySymbol($currency_code); } - $output.=$cursymbolbefore.$end.$cursymbolafter; + $output.=$cursymbolbefore.$end.$cursymbolafter; return $output; } @@ -3660,21 +3660,21 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) { global $conf; - $ret=''; - // If order not defined, we use the setup - if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)); - if ($nameorder) - { - $ret.=$firstname; - if ($firstname && $lastname) $ret.=' '; - $ret.=$lastname; - } - else - { - $ret.=$lastname; - if ($firstname && $lastname) $ret.=' '; - $ret.=$firstname; - } + $ret=''; + // If order not defined, we use the setup + if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)); + if ($nameorder) + { + $ret.=$firstname; + if ($firstname && $lastname) $ret.=' '; + $ret.=$lastname; + } + else + { + $ret.=$lastname; + if ($firstname && $lastname) $ret.=' '; + $ret.=$firstname; + } return $ret; } @@ -4293,18 +4293,18 @@ function colorArrayToHex($arraycolor,$colorifnotfound='888888') return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]); } -/** - * Set focus onto field with selector - * - * @param string $selector Selector ('#id') - * @return string HTML code to set focus - */ -function dol_set_focus($selector) -{ - print ''."\n"; - print ''."\n"; -} - +/** + * Set focus onto field with selector + * + * @param string $selector Selector ('#id') + * @return string HTML code to set focus + */ +function dol_set_focus($selector) +{ + print ''."\n"; + print ''."\n"; +} + if (! function_exists('getmypid')) { diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index f565467575e..2e87dfceea8 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -23,7 +23,7 @@ */ -// ------------------------------- Used by ajax tree view ----------------- +// ------------------------------- Used by ajax tree view ----------------- /** * Show indent and picto of a tree line. Return array with information of line. @@ -159,7 +159,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') print ''; } } - if (! empty($ulprinted) && ! empty($pere['rowid'])) { print ''."\n"; } + if (! empty($ulprinted) && ! empty($pere['rowid'])) { print ''."\n"; } if (empty($pere['rowid'])) print ''; } diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 6faf6e90a50..ebf70b6d9c9 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -21,7 +21,7 @@ * \file htdocs/core/menus/standard/auguria.lib.php * \brief Library for file auguria menus */ -require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; @@ -40,8 +40,8 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) { global $user,$conf,$langs,$dolibarr_main_db_name; - $mainmenu=$_SESSION["mainmenu"]; - $leftmenu=$_SESSION["leftmenu"]; + $mainmenu=$_SESSION["mainmenu"]; + $leftmenu=$_SESSION["leftmenu"]; $id='mainmenu'; $listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL); @@ -75,7 +75,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $shorturl = $newTabMenu[$i]['url'].$param; } $url=preg_replace('/__LOGIN__/',$user->login,$url); - $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); + $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; @@ -84,9 +84,9 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } else if ($showmode == 2) $classname='class="tmenu"'; - if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode); - if (empty($noout)) print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); - if (empty($noout)) print_end_menu_entry_auguria($showmode); + if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode); + if (empty($noout)) print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); + if (empty($noout)) print_end_menu_entry_auguria($showmode); $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ''); } @@ -138,23 +138,23 @@ function print_start_menu_entry_auguria($idsel,$classname,$showmode) */ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget) { - global $langs; + global $langs; - if ($showmode == 1) - { - print ''; - print '
'; - print '
'; - print ''; - print ''; - print $text; - print ''; - print ''; - } - if ($showmode == 2) - { - print '
'; - print ''; + if ($showmode == 1) + { + print ''; + print '
'; + print '
'; + print ''; + print ''; + print $text; + print ''; + print ''; + } + if ($showmode == 2) + { + print '
'; + print ''; print ''; print $text; print ''; @@ -245,7 +245,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM if (is_array($menu_array_before)) $menu_array=array_merge($menu_array_before, $menu_array); if (is_array($menu_array_after)) $menu_array=array_merge($menu_array, $menu_array_after); //var_dump($menu_array);exit; - if (! is_array($menu_array)) return 0; + if (! is_array($menu_array)) return 0; // Show menu if (empty($noout)) diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 19b4b15764f..e33d08403ac 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -36,7 +36,7 @@ class MenuManager var $menu_array; var $menu_array_after; - var $tabMenu; + var $tabMenu; /** @@ -52,59 +52,59 @@ class MenuManager } - /** - * Load this->tabMenu - * - * @return void - */ - function loadMenu() - { + /** + * Load this->tabMenu + * + * @return void + */ + function loadMenu() + { global $conf, $user, $langs; - // On sauve en session le menu principal choisi - if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; - if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"]; - - // Read mainmenu and leftmenu that define which menu to show - if (isset($_GET["mainmenu"])) - { - // On sauve en session le menu principal choisi - $mainmenu=$_GET["mainmenu"]; - $_SESSION["mainmenu"]=$mainmenu; - $_SESSION["leftmenuopened"]=""; - } - else - { - // On va le chercher en session si non defini par le lien - $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; - } - - if (isset($_GET["leftmenu"])) - { - // On sauve en session le menu principal choisi - $leftmenu=$_GET["leftmenu"]; - $_SESSION["leftmenu"]=$leftmenu; - - if ($_SESSION["leftmenuopened"]==$leftmenu) // To collapse - { - //$leftmenu=""; - $_SESSION["leftmenuopened"]=""; - } - else - { - $_SESSION["leftmenuopened"]=$leftmenu; - } - } else { - // On va le chercher en session si non defini par le lien - $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; - } - - require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; - $tabMenu=array(); - $menuArbo = new Menubase($this->db,'auguria'); + // On sauve en session le menu principal choisi + if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; + if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"]; + + // Read mainmenu and leftmenu that define which menu to show + if (isset($_GET["mainmenu"])) + { + // On sauve en session le menu principal choisi + $mainmenu=$_GET["mainmenu"]; + $_SESSION["mainmenu"]=$mainmenu; + $_SESSION["leftmenuopened"]=""; + } + else + { + // On va le chercher en session si non defini par le lien + $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; + } + + if (isset($_GET["leftmenu"])) + { + // On sauve en session le menu principal choisi + $leftmenu=$_GET["leftmenu"]; + $_SESSION["leftmenu"]=$leftmenu; + + if ($_SESSION["leftmenuopened"]==$leftmenu) // To collapse + { + //$leftmenu=""; + $_SESSION["leftmenuopened"]=""; + } + else + { + $_SESSION["leftmenuopened"]=$leftmenu; + } + } else { + // On va le chercher en session si non defini par le lien + $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; + } + + require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; + $tabMenu=array(); + $menuArbo = new Menubase($this->db,'auguria'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'auguria', $tabMenu); - // Modules system tools + // Modules system tools // TODO Find a way to add parent menu only if child menu exists. For the moment, no other method than hard coded methods. if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS)) { @@ -141,8 +141,8 @@ class MenuManager 'type'=>'left', 'position'=>20 )); - } - } + } + } $this->tabMenu=$tabMenu; } @@ -169,58 +169,58 @@ class MenuManager $res='ErrorBadParameterForMode'; require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; - $this->menu=new Menu(); + $this->menu=new Menu(); if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); - if ($mode == 'jmobile') - { - $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); - - foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' - { - print '
    '; - print '
  • '; - if ($val['enabled'] == 1) - { - $relurl=dol_buildpath($val['url'],1); - - print ''.$val['titre'].''."\n"; - // Search submenu fot this entry - $tmpmainmenu=$val['mainmenu']; - $tmpleftmenu='all'; - $submenu=new Menu(); - $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); - $nexturl=dol_buildpath($submenu->liste[0]['url'],1); - $canonrelurl=preg_replace('/\?.*$/','',$relurl); - $canonnexturl=preg_replace('/\?.*$/','',$nexturl); - //var_dump($canonrelurl); - //var_dump($canonnexturl); - print '
      '; - if ($canonrelurl != $canonnexturl && $val['mainmenu'] != 'home') - { - // We add sub entry - print '
    • '.$langs->trans("MainArea").'-'.$val['titre'].'
    • '."\n"; - } - foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' - { - $relurl2=dol_buildpath($val2['url'],1); - //var_dump($val2); - print ''.$val2['titre'].''."\n"; - } - //var_dump($submenu); - print '
    '; - } - if ($val['enabled'] == 2) - { - print ''.$val['titre'].''; - } - print '
  • '; - print '
'."\n"; - } + if ($mode == 'jmobile') + { + $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); + + foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + print '
    '; + print '
  • '; + if ($val['enabled'] == 1) + { + $relurl=dol_buildpath($val['url'],1); + + print ''.$val['titre'].''."\n"; + // Search submenu fot this entry + $tmpmainmenu=$val['mainmenu']; + $tmpleftmenu='all'; + $submenu=new Menu(); + $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); + $nexturl=dol_buildpath($submenu->liste[0]['url'],1); + $canonrelurl=preg_replace('/\?.*$/','',$relurl); + $canonnexturl=preg_replace('/\?.*$/','',$nexturl); + //var_dump($canonrelurl); + //var_dump($canonnexturl); + print '
      '; + if ($canonrelurl != $canonnexturl && $val['mainmenu'] != 'home') + { + // We add sub entry + print '
    • '.$langs->trans("MainArea").'-'.$val['titre'].'
    • '."\n"; + } + foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + { + $relurl2=dol_buildpath($val2['url'],1); + //var_dump($val2); + print ''.$val2['titre'].''."\n"; + } + //var_dump($submenu); + print '
    '; + } + if ($val['enabled'] == 2) + { + print ''.$val['titre'].''; + } + print '
  • '; + print '
'."\n"; + } } - unset($this->menu); + unset($this->menu); return $res; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 23970e6897c..42ab594b387 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -22,7 +22,7 @@ * \file htdocs/core/menus/standard/eldy.lib.php * \brief Library for file eldy menus */ -require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; /** @@ -58,7 +58,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("Home"), 1, DOL_URL_ROOT.'/index.php?mainmenu=home&leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_end_menu_entry($showmode); - $menu->add('/index.php?mainmenu=home&leftmenu=', $langs->trans("Home"), 0, $showmode, $atarget, "home", ''); + $menu->add('/index.php?mainmenu=home&leftmenu=', $langs->trans("Home"), 0, $showmode, $atarget, "home", ''); // Third parties $tmpentry=array('enabled'=>(! empty($conf->societe->enabled) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur'); @@ -187,9 +187,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='project'; - if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); - if (empty($noout)) print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry($showmode); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); + if (empty($noout)) print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&leftmenu=', $id, $idsel, $classname, $atarget); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/projet/index.php?mainmenu=project&leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", ''); } @@ -279,7 +279,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $shorturl = $newTabMenu[$i]['url'].$param; } $url=preg_replace('/__LOGIN__/',$user->login,$url); - $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); + $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; @@ -344,10 +344,10 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, if ($showmode == 1) { - print ''; - print '
'; - print '
'; - print ''; + print ''; + print '
'; + print '
'; + print ''; print ''; print $text; print ''; @@ -355,8 +355,8 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, } if ($showmode == 2) { - print '
'; - print '
'; + print '
'; + print '
'; print ''; print $text; print ''; @@ -1168,7 +1168,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (is_array($menu_array_before)) $menu_array=array_merge($menu_array_before, $menu_array); if (is_array($menu_array_after)) $menu_array=array_merge($menu_array, $menu_array_after); //var_dump($menu_array);exit; - if (! is_array($menu_array)) return 0; + if (! is_array($menu_array)) return 0; // Show menu if (empty($noout)) diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index fdf3a93e2fb..8b381ed7038 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -76,29 +76,29 @@ class MenuManager $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; } - if (isset($_GET["leftmenu"])) - { - // On sauve en session le menu principal choisi - $leftmenu=$_GET["leftmenu"]; - $_SESSION["leftmenu"]=$leftmenu; + if (isset($_GET["leftmenu"])) + { + // On sauve en session le menu principal choisi + $leftmenu=$_GET["leftmenu"]; + $_SESSION["leftmenu"]=$leftmenu; - if ($_SESSION["leftmenuopened"]==$leftmenu) // To collapse - { - //$leftmenu=""; - $_SESSION["leftmenuopened"]=""; - } - else - { - $_SESSION["leftmenuopened"]=$leftmenu; - } - } else { - // On va le chercher en session si non defini par le lien - $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; - } + if ($_SESSION["leftmenuopened"]==$leftmenu) // To collapse + { + //$leftmenu=""; + $_SESSION["leftmenuopened"]=""; + } + else + { + $_SESSION["leftmenuopened"]=$leftmenu; + } + } else { + // On va le chercher en session si non defini par le lien + $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; + } - require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; $tabMenu=array(); - $menuArbo = new Menubase($this->db,'eldy'); + $menuArbo = new Menubase($this->db,'eldy'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu); $this->tabMenu=$tabMenu; } @@ -126,7 +126,7 @@ class MenuManager require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - + if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); if ($mode == 'jmobile') @@ -156,7 +156,7 @@ class MenuManager if ($canonrelurl != $canonnexturl && $val['mainmenu'] != 'home') { // We add sub entry - print '
  • '.$langs->trans("MainArea").'-'.$val['titre'].'
  • '."\n"; + print '
  • '.$langs->trans("MainArea").'-'.$val['titre'].'
  • '."\n"; } foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { @@ -165,7 +165,7 @@ class MenuManager print ''.$val2['titre'].''."\n"; } //var_dump($submenu); - print ''; + print ''; } if ($val['enabled'] == 2) { diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 2e401e3cf10..14093ce5995 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -46,12 +46,12 @@ class MenuManager } - /** - * Load this->tabMenu - * - * @return void - */ - function loadMenu() + /** + * Load this->tabMenu + * + * @return void + */ + function loadMenu() { } @@ -70,7 +70,7 @@ class MenuManager $id='mainmenu'; require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; - $this->menu=new Menu(); + $this->menu=new Menu(); if ($mode == 'top') { @@ -183,7 +183,7 @@ class MenuManager */ function print_start_menu_array_empty() { - print '
    '; + print '
    '; print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 9def962c8ec..2311c6fe66e 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -237,7 +237,7 @@ class Export } $sql.=$sqlWhere; } - $sql.=$this->array_export_sql_order[$indice]; + $sql.=$this->array_export_sql_order[$indice]; return $sql; } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index fcd968eeeb0..b40988ca571 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("exports"); -$langs->load("users"); +$langs->load("users"); // Everybody should be able to go on this page //if (! $user->admin) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b3ae77d7ac3..4e93a5710b1 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -234,7 +234,7 @@ if (! file_exists(DOL_DOCUMENT_ROOT ."/core/lib/functions.lib.php")) print "Please run dolibarr setup by calling page /install.
    \n"; exit; } - + // Included by default include_once DOL_DOCUMENT_ROOT .'/core/lib/functions.lib.php'; diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index ec832a670d2..a4a9e06ccef 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -53,7 +53,7 @@ print_fiche_titre($langs->trans("SuppliersArea")); //print ''; //print '
    '; -print '
    '; +print '
    '; // Orders @@ -226,7 +226,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- //print '
    '; -print '
    '; +print '
    '; /* @@ -321,7 +321,7 @@ if (count($companystatic->SupplierCategories)) //print "
    \n"; -print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 27e45118fa8..8dfaf85ac71 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -82,12 +82,12 @@ class Holiday extends CommonObject */ function updateSold() { - // Mets à jour les congés payés en début de mois - $this->updateSoldeCP(); - - // Vérifie le nombre d'utilisateur et mets à jour si besoin - $this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser')); - return 1; + // Mets à jour les congés payés en début de mois + $this->updateSoldeCP(); + + // Vérifie le nombre d'utilisateur et mets à jour si besoin + $this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser')); + return 1; } /** diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index e5b609e36d1..e654dfe0117 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -74,10 +74,10 @@ if ($action == 'update' && isset($_POST['update_cp'])) // If it first update of sold, we set date to havoid to have sold incremented by new month $now=dol_now(); - $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; - $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'"; - $sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init. - dol_syslog('define_holiday update lastUpdate entry sql='.$sql); + $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; + $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'"; + $sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init. + dol_syslog('define_holiday update lastUpdate entry sql='.$sql); $result = $db->query($sql); $mesg='
    '.$langs->trans('UpdateConfCPOK').'
    '; diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index eb6d5dd5d7c..36f7afd87b1 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -30,11 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -$langs->load('users'); -$langs->load('holidays'); +$langs->load('users'); +$langs->load('holidays'); // Protection if external user if ($user->societe_id > 0) accessforbidden(); @@ -79,7 +79,7 @@ $search_statut = GETPOST('select_statut'); $holiday = new Holiday($db); $holidaystatic=new Holiday($db); -$fuser = new User($db); +$fuser = new User($db); // Update sold $holiday->updateSold(); @@ -165,12 +165,12 @@ if(!empty($search_statut) && $search_statut != -1) { // Récupération de l'ID de l'utilisateur $user_id = $user->id; -if ($id > 0) -{ - // Charge utilisateur edite - $fuser->fetch($id); +if ($id > 0) +{ + // Charge utilisateur edite + $fuser->fetch($id); $fuser->getrights(); - $user_id = $fuser->id; + $user_id = $fuser->id; } // Récupération des congés payés de l'utilisateur ou de tous les users if (!$user->rights->holiday->lire_tous || $id > 0) @@ -197,38 +197,38 @@ if ($holiday_payes == '-1') * Affichage du tableau des congés payés *************************************/ -$var=true; $num = count($holiday->holiday); -$form = new Form($db); -$formother = new FormOther($db); +$var=true; $num = count($holiday->holiday); +$form = new Form($db); +$formother = new FormOther($db); if ($id > 0) { - $head = user_prepare_head($fuser); - - $title = $langs->trans("User"); + $head = user_prepare_head($fuser); + + $title = $langs->trans("User"); dol_fiche_head($head, 'paidholidays', $title, 0, 'user'); - print ''; - - // Ref - print ''; - print ''; - print ''; - - // LastName - print ''; - print ''; - print "\n"; - - // FirstName - print ''; - print ''; - print "\n"; - - print '
    '.$langs->trans("Ref").''; - print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin); - print '
    '.$langs->trans("LastName").''.$fuser->lastname.'
    '.$langs->trans("FirstName").''.$fuser->firstname.'

    '; - + print ''; + + // Ref + print ''; + print ''; + print ''; + + // LastName + print ''; + print ''; + print "\n"; + + // FirstName + print ''; + print ''; + print "\n"; + + print '
    '.$langs->trans("Ref").''; + print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin); + print '
    '.$langs->trans("LastName").''.$fuser->lastname.'
    '.$langs->trans("FirstName").''.$fuser->firstname.'

    '; + } else { diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 0ae7303bf38..08651603e61 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -142,8 +142,8 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); - // Create the global $hookmanager object - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + // Create the global $hookmanager object + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($db); $ok = 0; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index ad9af68a6b9..7d4a22fffa2 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -314,25 +314,25 @@ function conf($dolibarr_main_document_root) //print 'SYSLOG_FILE='.SYSLOG_FILE;exit; } if (! defined('SYSLOG_FILE_NO_ERROR')) define('SYSLOG_FILE_NO_ERROR',1); - // We init log handler for install - $handlers = array('mod_syslog_file'); - foreach ($handlers as $handler) - { - $file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php'; - if (!file_exists($file)) - { - throw new Exception('Missing log handler file '.$handler.'.php'); - } - - require_once $file; - $loghandlerinstance = new $handler(); - if (!$loghandlerinstance instanceof LogHandlerInterface) - { - throw new Exception('Log handler does not extend LogHandlerInterface'); - } - + // We init log handler for install + $handlers = array('mod_syslog_file'); + foreach ($handlers as $handler) + { + $file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php'; + if (!file_exists($file)) + { + throw new Exception('Missing log handler file '.$handler.'.php'); + } + + require_once $file; + $loghandlerinstance = new $handler(); + if (!$loghandlerinstance instanceof LogHandlerInterface) + { + throw new Exception('Log handler does not extend LogHandlerInterface'); + } + if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler]=$loghandlerinstance; - } + } return 1; } diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index e04a3a94261..811f41f64e8 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -374,30 +374,30 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) // Run sql script $ok=run_sql($dir.$file, 0, '', 1); - // Scan if there is migration scripts for modules htdocs/module/sql or htdocs/custom/module/sql - $modulesfile = array(); - foreach ($conf->file->dol_document_root as $type => $dirroot) - { - $handlemodule=@opendir($dirroot); - if (is_resource($handlemodule)) + // Scan if there is migration scripts for modules htdocs/module/sql or htdocs/custom/module/sql + $modulesfile = array(); + foreach ($conf->file->dol_document_root as $type => $dirroot) + { + $handlemodule=@opendir($dirroot); + if (is_resource($handlemodule)) { - while (($filemodule = readdir($handlemodule))!==false) - { - if (is_dir($dirroot.'/'.$filemodule.'/sql')) + while (($filemodule = readdir($handlemodule))!==false) + { + if (is_dir($dirroot.'/'.$filemodule.'/sql')) { - //print "Scan for ".$dirroot . '/' . $filemodule . '/sql/'.$file; - if (is_file($dirroot . '/' . $filemodule . '/sql/'.$file)) - { - $modulesfile[$dirroot . '/' . $filemodule . '/sql/'.$file] = '/' . $filemodule . '/sql/'.$file; - } - } - } - closedir($handlemodule); - } - } + //print "Scan for ".$dirroot . '/' . $filemodule . '/sql/'.$file; + if (is_file($dirroot . '/' . $filemodule . '/sql/'.$file)) + { + $modulesfile[$dirroot . '/' . $filemodule . '/sql/'.$file] = '/' . $filemodule . '/sql/'.$file; + } + } + } + closedir($handlemodule); + } + } foreach ($modulesfile as $modulefilelong => $modulefileshort) - { + { print '

    '.$langs->trans("ChoosedMigrateScript").' (external modules)'.$modulefileshort.'
    '; //print '
    '; -print '
    '; +print '
    '; /* @@ -160,7 +160,7 @@ print '
    '; //print '
    '; -print '
    '; +print '
    '; /* @@ -259,7 +259,7 @@ else } //print '
    '; -print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index d544175b2fd..beb4c7829ba 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -45,7 +45,7 @@ print_fiche_titre($langs->trans("StocksArea")); //print ''; //print '
    '; -print '
    '; +print '
    '; /* @@ -106,7 +106,7 @@ else //print '
    '; -print '
    '; +print '
    '; // Last movements @@ -164,7 +164,7 @@ if ($resql) } //print '
    '; -print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index 0b6635fa390..5afeab8d639 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -58,9 +58,9 @@ $langs->load("paypal"); dol_syslog("Callback url when a PayBox payment was canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_paybox'); -$tracepost = ""; -foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; -dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); +$tracepost = ""; +foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; +dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); llxHeaderPayBox($langs->trans("PaymentForm")); diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index d46ae4f33a7..5553956ce82 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -57,9 +57,9 @@ $langs->load("paypal"); dol_syslog("Callback url when a PayBox payment was done. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_paybox'); -$tracepost = ""; -foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; -dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); +$tracepost = ""; +foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; +dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); llxHeaderPayBox($langs->trans("PaymentForm")); diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index 610e68c93e3..13c4718c361 100755 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -66,9 +66,9 @@ $langs->load("paypal"); dol_syslog("Callback url when a PayPal payment was canceled. query_string=".(empty($_SERVER["QUERY_STRING"])?'':$_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_paypal'); -$tracepost = ""; -foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; -dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal'); +$tracepost = ""; +foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; +dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal'); llxHeaderPaypal($langs->trans("PaymentForm")); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ecf387e13c2..37b81403acd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -82,9 +82,9 @@ class Societe extends CommonObject var $idprof1; // IdProf1 (Ex: Siren in France) var $idprof2; // IdProf2 (Ex: Siret in France) var $idprof3; // IdProf3 (Ex: Ape in France) - var $idprof4; // IdProf4 (Ex: RCS in France) - var $idprof5; // IdProf5 - var $idprof6; // IdProf6 + var $idprof4; // IdProf4 (Ex: RCS in France) + var $idprof5; // IdProf5 + var $idprof6; // IdProf6 var $prefix_comm; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 4f61d24a4aa..0edb8291677 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -70,9 +70,9 @@ if (GETPOST("button_removefilter")) $thirdTypeSelect = GETPOST("third_select_id"); $type_element = GETPOST('type_element')?GETPOST('type_element'):'invoice'; -$langs->load("bills"); -$langs->load("orders"); -$langs->load("suppliers"); +$langs->load("bills"); +$langs->load("orders"); +$langs->load("suppliers"); /* @@ -87,7 +87,7 @@ $langs->load("suppliers"); $form = new Form($db); $formother = new FormOther($db); -$productstatic=new Product($db); +$productstatic=new Product($db); $titre = $langs->trans("Referer",$object->name); llxHeader('',$titre,''); @@ -174,7 +174,7 @@ if ($type_element == 'order') { // TODO -} +} if ($type_element == 'supplier_order') { // Supplier : Show products from orders. $documentstatic=new CommandeFournisseur($db); @@ -217,13 +217,13 @@ $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); -// Define type of elements -$typeElementString = $form->selectarray("type_element",$elementTypeArray,GETPOST('type_element')); -$button = ''; -$param="&sref=".$sref."&month=".$month."&year=".$year."&sprod_fulldescr=".$sprod_fulldescr."&socid=".$socid; - -print_barre_liste($langs->trans('ProductsIntoElements', $typeElementString.' '.$button), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); - +// Define type of elements +$typeElementString = $form->selectarray("type_element",$elementTypeArray,GETPOST('type_element')); +$button = ''; +$param="&sref=".$sref."&month=".$month."&year=".$year."&sprod_fulldescr=".$sprod_fulldescr."&socid=".$socid; + +print_barre_liste($langs->trans('ProductsIntoElements', $typeElementString.' '.$button), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); + if ($sql_select) { dol_syslog("sql=".$sql); @@ -276,115 +276,115 @@ if ($sql_select) print ''; // Define text, description and type - $text=''; $description=''; $type=0; + $text=''; $description=''; $type=0; - // Code to show product duplicated from commonobject->printObjectLine - if ($objp->fk_product > 0) - { - $product_static = new Product($db); - - $product_static->type=$objp->fk_product_type; - $product_static->id=$objp->fk_product; - $product_static->ref=$objp->ref; - $text=$product_static->getNomUrl(1); + // Code to show product duplicated from commonobject->printObjectLine + if ($objp->fk_product > 0) + { + $product_static = new Product($db); + + $product_static->type=$objp->fk_product_type; + $product_static->id=$objp->fk_product; + $product_static->ref=$objp->ref; + $text=$product_static->getNomUrl(1); } - // Product - if ($objp->fk_product > 0) - { - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $this->fetch_thirdparty(); - $prod = new Product($db); - $prod->fetch($objp->fk_product); - - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); - if (empty($newlang)) $newlang=$this->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; - } - else - { - $label = $objp->product_label; - } - - $text.= ' - '.(! empty($objp->label)?$objp->label:$label); - $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); + // Product + if ($objp->fk_product > 0) + { + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $this->fetch_thirdparty(); + $prod = new Product($db); + $prod->fetch($objp->fk_product); + + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); + if (empty($newlang)) $newlang=$this->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; + } + else + { + $label = $objp->product_label; + } + + $text.= ' - '.(! empty($objp->label)?$objp->label:$label); + $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); } - if (($objp->info_bits & 2) == 2) { ?> - - trans("ShowReduc"),'reduc').' '; - if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); - //else $txt=$langs->trans("Discount"); - print $txt; - ?> - - description) - { - if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) - { - $discount=new DiscountAbsolute($db); - $discount->fetch($objp->fk_remise_except); - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); - } - elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) - { - $discount=new DiscountAbsolute($db); - $discount->fetch($objp->fk_remise_except); - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); - // Add date of deposit - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; - } - else - { - echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description); - } - } - } - else - { - if ($objp->fk_product > 0) { - - echo $form->textwithtooltip($text,$description,3,'','',$i,0,''); - - // Show range - echo get_date_range($objp->date_start, $objp->date_end); - - // Add description in form - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) - { - print (! empty($objp->description) && $objp->description!=$objp->product_label)?'
    '.dol_htmlentitiesbr($objp->description):''; - } - - } else { - - //if (! empty($objp->fk_parent_line)) echo img_picto('', 'rightarrow'); - if ($type==1) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); - - if (! empty($objp->label)) { - $text.= ' '.$objp->label.''; - echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,''); - } else { - echo $text.' '.dol_htmlentitiesbr($objp->description); - } - - // Show range - echo get_date_range($objp->date_start,$objp->date_end); - } - } + if (($objp->info_bits & 2) == 2) { ?> + + trans("ShowReduc"),'reduc').' '; + if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); + //else $txt=$langs->trans("Discount"); + print $txt; + ?> + + description) + { + if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($db); + $discount->fetch($objp->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); + } + elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($db); + $discount->fetch($objp->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); + // Add date of deposit + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; + } + else + { + echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description); + } + } + } + else + { + if ($objp->fk_product > 0) { + + echo $form->textwithtooltip($text,$description,3,'','',$i,0,''); + + // Show range + echo get_date_range($objp->date_start, $objp->date_end); + + // Add description in form + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + print (! empty($objp->description) && $objp->description!=$objp->product_label)?'
    '.dol_htmlentitiesbr($objp->description):''; + } + + } else { + + //if (! empty($objp->fk_parent_line)) echo img_picto('', 'rightarrow'); + if ($type==1) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); + + if (! empty($objp->label)) { + $text.= ' '.$objp->label.''; + echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,''); + } else { + echo $text.' '.dol_htmlentitiesbr($objp->description); + } + + // Show range + echo get_date_range($objp->date_start,$objp->date_end); + } + } /* $prodreftxt=''; @@ -396,16 +396,16 @@ if ($sql_select) $prodreftxt = $productstatic->getNomUrl(0); if(!empty($objp->product_label)) $prodreftxt .= ' - '.$objp->product_label; } - // Show range - $prodreftxt .= get_date_range($objp->date_start, $objp->date_end); - // Add description in form - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) - { - $prodreftxt .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'
    '.dol_htmlentitiesbr($objp->description):''; + // Show range + $prodreftxt .= get_date_range($objp->date_start, $objp->date_end); + // Add description in form + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + $prodreftxt .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'
    '.dol_htmlentitiesbr($objp->description):''; } */ - print ''; - + print ''; + //print ''.$prodreftxt.''; print ''.$objp->prod_qty.''; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index e113ad7e0e1..74d8b74c4d4 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -51,7 +51,7 @@ print_fiche_titre($transAreaType); //print ''; //print '
    '; -print '
    '; +print '
    '; /* @@ -152,7 +152,7 @@ print '
    '; //print ''; -print '
    '; +print '
    '; /* diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 6f806f4594f..45e2285d44a 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -60,7 +60,7 @@ $fontsizesmaller=empty($conf->browser->phone)?'11':'11'; $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; -$path=''; // This value may be used in future for external module to overwrite theme +$path=''; // This value may be used in future for external module to overwrite theme $theme='bureau2crea'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 665f58b0b89..0cd62a11591 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -61,7 +61,7 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); $path=''; // This value may be used in future for external module to overwrite theme $theme='eldy'; // Value of theme -if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } +if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } // Define image path files $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; diff --git a/htdocs/theme/phones/smartphone/tpl/menu.tpl.php b/htdocs/theme/phones/smartphone/tpl/menu.tpl.php index 971dbc80885..d286345eada 100644 --- a/htdocs/theme/phones/smartphone/tpl/menu.tpl.php +++ b/htdocs/theme/phones/smartphone/tpl/menu.tpl.php @@ -15,14 +15,14 @@ * along with this program. If not, see . */ -// Load the smartphone menu manager -$result=@include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu; -if (! $result) // If failed to include, we try with standard -{ - $conf->smart_menu='smartphone_menu.php'; - include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu; -} -$menusmart = new MenuSmart($db, $user->societe_id?1:0); +// Load the smartphone menu manager +$result=@include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu; +if (! $result) // If failed to include, we try with standard +{ + $conf->smart_menu='smartphone_menu.php'; + include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu; +} +$menusmart = new MenuSmart($db, $user->societe_id?1:0); top_httphead(); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index bd7095f4d03..c04f96b09db 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -913,10 +913,10 @@ class User extends CommonObject $this->office_fax = $contact->fax; $this->user_mobile = $contact->phone_mobile; $this->address = $contact->address; - $this->zip = $contact->zip; - $this->town = $contact->town; + $this->zip = $contact->zip; + $this->town = $contact->town; $this->state_id = $contact->state_id; - $this->country_id = $contact->country_id; + $this->country_id = $contact->country_id; if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); $this->login = $login; @@ -984,11 +984,11 @@ class User extends CommonObject $this->email = $member->email; $this->fk_member = $member->id; $this->pass = $member->pass; - $this->address = $member->address; - $this->zip = $member->zip; - $this->town = $member->town; - $this->state_id = $member->state_id; - $this->country_id = $member->country_id; + $this->address = $member->address; + $this->zip = $member->zip; + $this->town = $member->town; + $this->state_id = $member->state_id; + $this->country_id = $member->country_id; if (empty($login)) $login=strtolower(substr($member->firstname, 0, 4)) . strtolower(substr($member->lastname, 0, 4)); $this->login = $login; @@ -2108,205 +2108,205 @@ class User extends CommonObject } - /** - * Return and array with all instanciated children users of current user - * - * @return void - */ - function get_children() - { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; - $sql.= " WHERE fk_user = ".$this->id; + /** + * Return and array with all instanciated children users of current user + * + * @return void + */ + function get_children() + { + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; + $sql.= " WHERE fk_user = ".$this->id; - dol_syslog(get_class($this)."::get_children result=".$result, LOG_DEBUG); - $res = $this->db->query($sql); - if ($res) - { - $users = array (); - while ($rec = $this->db->fetch_array($res)) - { - $user = new User($this->db); - $user->fetch($rec['rowid']); - $users[] = $user; - } - return $users; - } - else - { - dol_print_error($this->db); - return -1; - } - } - - - /** - * Load this->parentof that is array(id_son=>id_parent, ...) - * - * @return int <0 if KO, >0 if OK - */ - private function load_parentof() - { - global $conf; - - $this->parentof=array(); - - // Load array[child]=parent - $sql = "SELECT fk_user as id_parent, rowid as id_son"; - $sql.= " FROM ".MAIN_DB_PREFIX."user"; - $sql.= " WHERE fk_user != 0"; - $sql.= " AND entity = ".$conf->entity; - - dol_syslog(get_class($this)."::load_parentof sql=".$sql); - $resql = $this->db->query($sql); - if ($resql) - { - while ($obj= $this->db->fetch_object($resql)) - { - $this->parentof[$obj->id_son]=$obj->id_parent; - } - return 1; - } - else - { - dol_print_error($this->db); - return -1; - } - } - - /** - * Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau - * Renvoi un tableau de tableau('id','id_parent',...) trie selon arbre et avec: - * id = id du user - * id_parent = id du user parent - * id_children = tableau des id enfant - * name = nom du user - * fullname = nom avec chemin complet du user - * fullpath = chemin complet compose des id - * - * @param int $markafterid Removed all users including the leaf $markafterid in user tree. - * @return array Array of users. this->users and this->parentof are set. - */ - function get_full_tree($markafterid=0) - { - $this->users = array(); - - // Init this->parentof that is array(id_son=>id_parent, ...) - $this->load_parentof(); - - // Init $this->users array - $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates - $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; - - dol_syslog(get_class($this)."::get_full_tree get user list sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $i=0; - while ($obj = $this->db->fetch_object($resql)) - { - $this->users[$obj->rowid]['rowid'] = $obj->rowid; - $this->users[$obj->rowid]['id'] = $obj->rowid; - $this->users[$obj->rowid]['fk_user'] = $obj->fk_user; - $this->users[$obj->rowid]['firstname'] = $obj->firstname; - $this->users[$obj->rowid]['lastname'] = $obj->lastname; + dol_syslog(get_class($this)."::get_children result=".$result, LOG_DEBUG); + $res = $this->db->query($sql); + if ($res) + { + $users = array (); + while ($rec = $this->db->fetch_array($res)) + { + $user = new User($this->db); + $user->fetch($rec['rowid']); + $users[] = $user; + } + return $users; + } + else + { + dol_print_error($this->db); + return -1; + } + } + + + /** + * Load this->parentof that is array(id_son=>id_parent, ...) + * + * @return int <0 if KO, >0 if OK + */ + private function load_parentof() + { + global $conf; + + $this->parentof=array(); + + // Load array[child]=parent + $sql = "SELECT fk_user as id_parent, rowid as id_son"; + $sql.= " FROM ".MAIN_DB_PREFIX."user"; + $sql.= " WHERE fk_user != 0"; + $sql.= " AND entity = ".$conf->entity; + + dol_syslog(get_class($this)."::load_parentof sql=".$sql); + $resql = $this->db->query($sql); + if ($resql) + { + while ($obj= $this->db->fetch_object($resql)) + { + $this->parentof[$obj->id_son]=$obj->id_parent; + } + return 1; + } + else + { + dol_print_error($this->db); + return -1; + } + } + + /** + * Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau + * Renvoi un tableau de tableau('id','id_parent',...) trie selon arbre et avec: + * id = id du user + * id_parent = id du user parent + * id_children = tableau des id enfant + * name = nom du user + * fullname = nom avec chemin complet du user + * fullpath = chemin complet compose des id + * + * @param int $markafterid Removed all users including the leaf $markafterid in user tree. + * @return array Array of users. this->users and this->parentof are set. + */ + function get_full_tree($markafterid=0) + { + $this->users = array(); + + // Init this->parentof that is array(id_son=>id_parent, ...) + $this->load_parentof(); + + // Init $this->users array + $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates + $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; + $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; + + dol_syslog(get_class($this)."::get_full_tree get user list sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + $i=0; + while ($obj = $this->db->fetch_object($resql)) + { + $this->users[$obj->rowid]['rowid'] = $obj->rowid; + $this->users[$obj->rowid]['id'] = $obj->rowid; + $this->users[$obj->rowid]['fk_user'] = $obj->fk_user; + $this->users[$obj->rowid]['firstname'] = $obj->firstname; + $this->users[$obj->rowid]['lastname'] = $obj->lastname; $this->users[$obj->rowid]['login'] = $obj->login; $this->users[$obj->rowid]['statut'] = $obj->statut; - $i++; - } - } - else - { - dol_print_error($this->db); - return -1; - } - - // We add the fullpath property to each elements of first level (no parent exists) - dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG); - foreach($this->users as $key => $val) - { - $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent) - } - - // Exclude leaf including $markafterid from tree - if ($markafterid) - { - //print "Look to discard user ".$markafterid."\n"; - $keyfilter1='^'.$markafterid.'$'; - $keyfilter2='_'.$markafterid.'$'; - $keyfilter3='^'.$markafterid.'_'; - $keyfilter4='_'.$markafterid.'_'; - foreach($this->users as $key => $val) - { - if (preg_match('/'.$keyfilter1.'/',$val['fullpath']) || preg_match('/'.$keyfilter2.'/',$val['fullpath']) - || preg_match('/'.$keyfilter3.'/',$val['fullpath']) || preg_match('/'.$keyfilter4.'/',$val['fullpath'])) - { - unset($this->users[$key]); - } - } - } - - dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG); - $this->users=dol_sort_array($this->users, 'fullname', 'asc', true, false); - - //$this->debug_users(); - - return $this->users; - } - - /** - * For user id_user and its childs available in this->users, define property fullpath and fullname - * - * @param int $id_user id_user entry to update - * @param int $protection Deep counter to avoid infinite loop - * @return void - */ - function build_path_from_id_user($id_user,$protection=1000) - { - dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); - - if (! empty($this->users[$id_user]['fullpath'])) - { - // Already defined - dol_syslog(get_class($this)."::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); - return; - } - - // Define fullpath and fullname - $this->users[$id_user]['fullpath'] = '_'.$id_user; - $this->users[$id_user]['fullname'] = $this->users[$id_user]['label']; - $i=0; $cursor_user=$id_user; - - while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user])) - { - $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; - $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['label'].' >> '.$this->users[$id_user]['fullname']; - $i++; $cursor_user=$this->parentof[$cursor_user]; - } - - // We count number of _ to have level - $this->users[$id_user]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->users[$id_user]['fullpath'])); - - return; - } - - /** - * Affiche contenu de $this->users - * - * @return void - */ - function debug_users() - { - // Affiche $this->users - foreach($this->users as $key => $val) - { - print 'id: '.$this->users[$key]['id']; - print ' name: '.$this->users[$key]['name']; - print ' parent: '.$this->users[$key]['fk_user']; - print ' fullpath: '.$this->users[$key]['fullpath']; - print ' fullname: '.$this->users[$key]['fullname']; - print "
    \n"; - } + $i++; + } + } + else + { + dol_print_error($this->db); + return -1; + } + + // We add the fullpath property to each elements of first level (no parent exists) + dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG); + foreach($this->users as $key => $val) + { + $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent) + } + + // Exclude leaf including $markafterid from tree + if ($markafterid) + { + //print "Look to discard user ".$markafterid."\n"; + $keyfilter1='^'.$markafterid.'$'; + $keyfilter2='_'.$markafterid.'$'; + $keyfilter3='^'.$markafterid.'_'; + $keyfilter4='_'.$markafterid.'_'; + foreach($this->users as $key => $val) + { + if (preg_match('/'.$keyfilter1.'/',$val['fullpath']) || preg_match('/'.$keyfilter2.'/',$val['fullpath']) + || preg_match('/'.$keyfilter3.'/',$val['fullpath']) || preg_match('/'.$keyfilter4.'/',$val['fullpath'])) + { + unset($this->users[$key]); + } + } + } + + dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG); + $this->users=dol_sort_array($this->users, 'fullname', 'asc', true, false); + + //$this->debug_users(); + + return $this->users; + } + + /** + * For user id_user and its childs available in this->users, define property fullpath and fullname + * + * @param int $id_user id_user entry to update + * @param int $protection Deep counter to avoid infinite loop + * @return void + */ + function build_path_from_id_user($id_user,$protection=1000) + { + dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); + + if (! empty($this->users[$id_user]['fullpath'])) + { + // Already defined + dol_syslog(get_class($this)."::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); + return; + } + + // Define fullpath and fullname + $this->users[$id_user]['fullpath'] = '_'.$id_user; + $this->users[$id_user]['fullname'] = $this->users[$id_user]['label']; + $i=0; $cursor_user=$id_user; + + while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user])) + { + $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; + $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['label'].' >> '.$this->users[$id_user]['fullname']; + $i++; $cursor_user=$this->parentof[$cursor_user]; + } + + // We count number of _ to have level + $this->users[$id_user]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->users[$id_user]['fullpath'])); + + return; + } + + /** + * Affiche contenu de $this->users + * + * @return void + */ + function debug_users() + { + // Affiche $this->users + foreach($this->users as $key => $val) + { + print 'id: '.$this->users[$key]['id']; + print ' name: '.$this->users[$key]['name']; + print ' parent: '.$this->users[$key]['fk_user']; + print ' fullpath: '.$this->users[$key]['fullpath']; + print ' fullname: '.$this->users[$key]['fullname']; + print "
    \n"; + } } } diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 0d2586c9639..a614416dcf8 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -682,7 +682,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print '
    '; } - print dol_set_focus('#lastname'); + print dol_set_focus('#lastname'); print '
    '; print ''; @@ -1199,18 +1199,18 @@ else print ''.$langs->trans('Signature').''; print dol_htmlentitiesbr($object->signature); print "\n"; - - // Hierarchy - print ''.$langs->trans("HierarchicalResponsible").''; - print ''; - if (empty($object->fk_user)) print $langs->trans("None"); - else { - $huser=new User($db); - $huser->fetch($object->fk_user); - print $huser->getNomUrl(1); - } - print ''; - print "\n"; + + // Hierarchy + print ''.$langs->trans("HierarchicalResponsible").''; + print ''; + if (empty($object->fk_user)) print $langs->trans("None"); + else { + $huser=new User($db); + $huser->fetch($object->fk_user); + print $huser->getNomUrl(1); + } + print ''; + print "\n"; // Status print ''.$langs->trans("Status").''; @@ -1283,22 +1283,22 @@ else print ''."\n"; } - // Multicompany - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print ''.$langs->trans("Entity").''; - if ($object->admin && ! $object->entity) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($object->entity); - print $mc->label; - } - print "\n"; - } - + // Multicompany + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print ''.$langs->trans("Entity").''; + if ($object->admin && ! $object->entity) + { + print $langs->trans("AllEntities"); + } + else + { + $mc->getInfo($object->entity); + print $mc->label; + } + print "\n"; + } + // Other attributes $parameters=array('colspan' => ' colspan="2"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -1814,7 +1814,7 @@ else print dol_htmlentitiesbr($object->signature); } print ''; - + // openid if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) { @@ -1832,10 +1832,10 @@ else print ''; } - // Hierarchy - print ''.$langs->trans("HierarchicalResponsible").''; + // Hierarchy + print ''.$langs->trans("HierarchicalResponsible").''; print ''; - if ($caneditfield) + if ($caneditfield) { print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$object->entity); } @@ -1845,9 +1845,9 @@ else $huser=new User($db); $huser->fetch($object->fk_user); print $huser->getNomUrl(1); - } - print ''; - print "\n"; + } + print ''; + print "\n"; // Status print ''.$langs->trans("Status").''; diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index afcd72ec76a..0f2ccff204d 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -26,12 +26,12 @@ */ require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; if (! $user->rights->user->user->lire && ! $user->admin) accessforbidden(); -$langs->load("users"); +$langs->load("users"); $langs->load("companies"); // Security check (for external users) @@ -53,12 +53,12 @@ $companystatic = new Societe($db); $form = new Form($db); -$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); -$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); +$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); +$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); llxHeader('',$langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')','','',0,0,$arrayofjs,$arrayofcss); - -print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '
    '); + +print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '
    '); @@ -67,51 +67,51 @@ $user_arbo = $userstatic->get_full_tree(); // Define fulltree array $fulltree=$user_arbo; - -// Define data (format for treeview) -$data=array(); -$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); -foreach($fulltree as $key => $val) + +// Define data (format for treeview) +$data=array(); +$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); +foreach($fulltree as $key => $val) { - $userstatic->id=$val['id']; - $userstatic->ref=$val['label']; + $userstatic->id=$val['id']; + $userstatic->ref=$val['label']; $userstatic->firstname=$val['firstname']; $userstatic->lastname=$val['name']; $userstatic->statut=$val['statut']; - $li=$userstatic->getNomUrl(1,'').' ('.$val['login'].')'; - - $data[] = array( - 'rowid'=>$val['rowid'], - 'fk_menu'=>$val['fk_user'], - 'entry'=>'
    '.$li.''.$userstatic->getLibStatut(5).'
    ' - ); -} - - -print ''; + $li=$userstatic->getNomUrl(1,'').' ('.$val['login'].')'; + + $data[] = array( + 'rowid'=>$val['rowid'], + 'fk_menu'=>$val['fk_user'], + 'entry'=>'
    '.$li.''.$userstatic->getLibStatut(5).'
    ' + ); +} + + +print ''; print ''; - -$nbofentries=(count($data) - 1); - -if ($nbofentries > 0) -{ - print ''; -} -else -{ - print ''; - print ''; - print ''; -} - +print ' | '.img_picto('','object_category-expanded').' '.$langs->trans("ExpandAll").''; + +$nbofentries=(count($data) - 1); + +if ($nbofentries > 0) +{ + print ''; +} +else +{ + print ''; + print ''; + print ''; +} + print "
    '.$langs->trans("HierarchicView").'
    '; - tree_recur($data,$data[0],0); - print '
    '; - print ''; - print ''; - print '
    '.img_picto_common('','treemenu/branchbottom.gif').''; - print $langs->trans("NoCategoryYet"); - print ' 
    '; + tree_recur($data,$data[0],0); + print '
    '; + print ''; + print ''; + print '
    '.img_picto_common('','treemenu/branchbottom.gif').''; + print $langs->trans("NoCategoryYet"); + print ' 
    "; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 66c74e5d290..8c2de389a39 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -58,7 +58,7 @@ print_fiche_titre($langs->trans("MenuUsersAndGroups")); //print ''; //print '
    '; -print '
    '; +print '
    '; // Search User @@ -90,7 +90,7 @@ if ($canreadperms) //print '
    '; -print '
    '; +print '
    '; /* @@ -254,7 +254,7 @@ if ($canreadperms) } //print '
    '; -print '
    '; +print '
    '; llxFooter(); diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index ef7384a11c7..014eba8fcb4 100755 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -398,7 +398,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty) //$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'"; //$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'"; $sql.=" WHERE f.entity = ".$conf->entity; - if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty); + if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty); $resql=$db->query($sql); if ($resql) @@ -413,11 +413,11 @@ function getInvoicesForThirdParty($authentication,$idthirdparty) $invoice=new Facture($db); $invoice->fetch($obj->facid); - // Sécurité pour utilisateur externe - if( $socid && ( $socid != $order->socid) ) - { - $error++; - $errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.' User does not have permission for this request'; + // Sécurité pour utilisateur externe + if( $socid && ( $socid != $order->socid) ) + { + $error++; + $errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.' User does not have permission for this request'; } // Define lines of invoice diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 6ba0fa2cd5e..ee311e17bc1 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -71,18 +71,18 @@ $server->wsdl->addComplexType( 'entity' => array('name'=>'entity','type'=>'xsd:string') ) ); -// Define WSDL Return object -$server->wsdl->addComplexType( - 'result', - 'complexType', - 'struct', - 'all', - '', - array( - 'result_code' => array('name'=>'result_code','type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label','type'=>'xsd:string'), - ) -); +// Define WSDL Return object +$server->wsdl->addComplexType( + 'result', + 'complexType', + 'struct', + 'all', + '', + array( + 'result_code' => array('name'=>'result_code','type'=>'xsd:string'), + 'result_label' => array('name'=>'result_label','type'=>'xsd:string'), + ) +); // Define other specific objects $server->wsdl->addComplexType( @@ -389,9 +389,9 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='') 'project_id' => $order->fk_project, 'date' => $order->date_commande?dol_print_date($order->date_commande,'dayrfc'):'', - 'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'', - 'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'', - 'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'', + 'date_creation' => $invoice->date_creation?dol_print_date($invoice->date_creation,'dayhourrfc'):'', + 'date_validation' => $invoice->date_validation?dol_print_date($invoice->date_creation,'dayhourrfc'):'', + 'date_modification' => $invoice->datem?dol_print_date($invoice->datem,'dayhourrfc'):'', 'remise' => $order->remise, 'remise_percent' => $order->remise_percent, @@ -406,7 +406,7 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='') 'cond_reglement' => $order->cond_reglement, 'mode_reglement_id' => $order->mode_reglement_id, 'mode_reglement_code' => $order->mode_reglement_code, - 'mode_reglement' => $order->mode_reglement, + 'mode_reglement' => $order->mode_reglement, 'date_livraison' => $order->date_livraison, 'fk_delivery_address' => $order->fk_delivery_address, @@ -674,13 +674,13 @@ function createOrder($authentication,$order) } - if ($newobject->statut == 1) // We want order validated - { - $result=$newobject->validate($fuser); - if ($result < 0) - { - $error++; - } + if ($newobject->statut == 1) // We want order validated + { + $result=$newobject->validate($fuser); + if ($result < 0) + { + $error++; + } } if (! $error) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 04708072d0e..e51caadb124 100755 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -145,12 +145,12 @@ $server->wsdl->addComplexType( 'sequence', '', array( - 'image' => array( - 'name' => 'image', - 'type' => 'tns:image', - 'minOccurs' => '0', + 'image' => array( + 'name' => 'image', + 'type' => 'tns:image', + 'minOccurs' => '0', 'maxOccurs' => 'unbounded' - ) + ) ) ); diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 159fadd3a61..151af859fcd 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -31,33 +31,33 @@ if (! defined('NOLOGIN')) define('NOLOGIN','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -$sapi_type = php_sapi_name(); -$script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; - -// Test if batch mode -if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; - exit; -} - +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path=dirname(__FILE__).'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit; +} + if (! isset($argv[1]) || ! $argv[1]) { print "Usage: ".$script_file." securitykey userlogin cronjobid(optional)\n"; exit; } -$key=$argv[1]; +$key=$argv[1]; + +if (! isset($argv[2]) || ! $argv[2]) { + print "Usage: ".$script_file." securitykey userlogin cronjobid(optional)\n"; + exit; +} else { + $userlogin=$argv[2]; +} -if (! isset($argv[2]) || ! $argv[2]) { - print "Usage: ".$script_file." securitykey userlogin cronjobid(optional)\n"; - exit; -} else { - $userlogin=$argv[2]; -} - require_once ($path."../../htdocs/master.inc.php"); require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"); -require_once (DOL_DOCUMENT_ROOT.'/user/class/user.class.php'); -require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"); +require_once (DOL_DOCUMENT_ROOT.'/user/class/user.class.php'); +require_once (DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"); /* diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 83c27b23aab..e62403366fb 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -44,7 +44,7 @@ if (! isset($argv[1]) || ! $argv[1] || ! in_array($argv[1],array('test','confirm print "If you add a delay (nb of days), only invoice with due date < today + delay are included.\n"; exit; } -$mode=$argv[1]; +$mode=$argv[1]; require($path."../../htdocs/master.inc.php"); @@ -60,7 +60,7 @@ $now=dol_now('tzserver'); $duration_value=$argv[2]; $error = 0; -print $script_file." launched with mode ".$mode.($duration_value?" delay=".$duration_value:"")."\n"; +print $script_file." launched with mode ".$mode.($duration_value?" delay=".$duration_value:"")."\n"; $sql = "SELECT f.facnumber, f.total_ttc, s.nom as name, u.rowid as uid, u.lastname, u.firstname, u.email, u.lang"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; @@ -155,8 +155,8 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang) $newlangs=new Translate('',$conf); $newlangs->setDefaultLang($userlang); - $newlangs->load("main"); - $newlangs->load("bills"); + $newlangs->load("main"); + $newlangs->load("bills"); $subject = "[".(empty($conf->global->MAIN_APPLICATION_TITLE)?'Dolibarr':$conf->global->MAIN_APPLICATION_TITLE)."] ".$newlangs->trans("ListOfYourUnpaidInvoices"); $sendto = $oldemail; @@ -168,8 +168,8 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang) dol_syslog("email_unpaid_invoices_to_representatives.php: send mail to ".$oldemail); $usehtml=0; - if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_FOOTER)) $usehtml+=1; - if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_HEADER)) $usehtml+=1; + if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_FOOTER)) $usehtml+=1; + if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_HEADER)) $usehtml+=1; $allmessage=''; if (! empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_HEADER)) @@ -188,7 +188,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang) { $allmessage.=$conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_FOOTER; if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_FOOTER)) $usehtml+=1; - } + } $mail = new CMailFile( $subject, @@ -207,8 +207,8 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang) $mail->errors_to = $errorsto; // Send or not email - if ($mode == 'confirm') - { + if ($mode == 'confirm') + { $result=$mail->sendfile(); } else diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 38d90d19fdf..b22dd5b1ea2 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -137,8 +137,8 @@ class AllTests $suite->addTestSuite('CompanyBankAccountTest'); require_once dirname(__FILE__).'/ChargeSocialesTest.php'; $suite->addTestSuite('ChargeSocialesTest'); - require_once dirname(__FILE__).'/HolidayTest.php'; - $suite->addTestSuite('HolidayTest'); + require_once dirname(__FILE__).'/HolidayTest.php'; + $suite->addTestSuite('HolidayTest'); require_once dirname(__FILE__).'/CategorieTest.php'; $suite->addTestSuite('CategorieTest'); @@ -147,12 +147,12 @@ class AllTests $suite->addTestSuite('WebservicesInvoicesTest'); require_once dirname(__FILE__).'/WebservicesOrdersTest.php'; $suite->addTestSuite('WebservicesOrdersTest'); - require_once dirname(__FILE__).'/WebservicesOtherTest.php'; - $suite->addTestSuite('WebservicesOtherTest'); - require_once dirname(__FILE__).'/WebservicesThirdpartyTest.php'; - $suite->addTestSuite('WebservicesThirdpartyTest'); - require_once dirname(__FILE__).'/WebservicesUserTest.php'; - $suite->addTestSuite('WebservicesUserTest'); + require_once dirname(__FILE__).'/WebservicesOtherTest.php'; + $suite->addTestSuite('WebservicesOtherTest'); + require_once dirname(__FILE__).'/WebservicesThirdpartyTest.php'; + $suite->addTestSuite('WebservicesThirdpartyTest'); + require_once dirname(__FILE__).'/WebservicesUserTest.php'; + $suite->addTestSuite('WebservicesUserTest'); require_once dirname(__FILE__).'/ExportTest.php'; $suite->addTestSuite('ExportTest'); diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index 2a920d0bb37..3f0beed9ba5 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -30,10 +30,10 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/contact/class/contact.class.php'; $langs->load("dict"); -if ($langs->defaultlang != 'en_US') -{ - print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; - exit; +if ($langs->defaultlang != 'en_US') +{ + print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; + exit; } if (empty($user->id)) diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index eba01ef016a..a59308f4628 100755 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -126,10 +126,10 @@ class CoreTest extends PHPUnit_Framework_TestCase global $dolibarr_main_prod; global $dolibarr_main_url_root; - global $dolibarr_main_data_root; - global $dolibarr_main_document_root; - global $dolibarr_main_data_root_alt; - global $dolibarr_main_document_root_alt; + global $dolibarr_main_data_root; + global $dolibarr_main_document_root; + global $dolibarr_main_data_root_alt; + global $dolibarr_main_document_root_alt; global $dolibarr_main_db_host; global $dolibarr_main_db_port; global $dolibarr_main_db_type; diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 17be4938ef5..65983390cfd 100755 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -116,63 +116,63 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSInvoices_xxx - * - * @return int - */ - public function testWSInvoices_xxx() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; + + /** + * testWSInvoices_xxx + * + * @return int + */ + public function testWSInvoices_xxx() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; } } diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php index f14aa1db9f8..a4571557a48 100755 --- a/test/phpunit/WebservicesOrdersTest.php +++ b/test/phpunit/WebservicesOrdersTest.php @@ -116,242 +116,242 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSOrder_xxx - * - * @return int - */ - public function testWSOrder_xxx() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_order.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; + + /** + * testWSOrder_xxx + * + * @return int + */ + public function testWSOrder_xxx() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_order.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; } - - /** - * testWSOther_GetVersions - * - * @return int - */ - public function testWSOther_GetVersions() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; - $WS_METHOD = 'getVersions'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } + + /** + * testWSOther_GetVersions + * + * @return int + */ + public function testWSOther_GetVersions() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; + $WS_METHOD = 'getVersions'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } - /** - * testWSThirdparty - * - * @return int - */ - public function testWSThirdparty() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } - - - /** - * testWSUser - * - * @return int - */ - public function testWSUser() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_user.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } + /** + * testWSThirdparty + * + * @return int + */ + public function testWSThirdparty() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } + + + /** + * testWSUser + * + * @return int + */ + public function testWSUser() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_user.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } } ?> \ No newline at end of file diff --git a/test/phpunit/WebservicesOtherTest.php b/test/phpunit/WebservicesOtherTest.php index 14cb83488eb..e06477e7de9 100755 --- a/test/phpunit/WebservicesOtherTest.php +++ b/test/phpunit/WebservicesOtherTest.php @@ -116,64 +116,64 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSOther_GetVersions - * - * @return int - */ - public function testWSOther_GetVersions() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; - $WS_METHOD = 'getVersions'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } + + /** + * testWSOther_GetVersions + * + * @return int + */ + public function testWSOther_GetVersions() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; + $WS_METHOD = 'getVersions'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + $this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } } ?> \ No newline at end of file diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php index 0d54a2d6434..b28ac8fa2d8 100755 --- a/test/phpunit/WebservicesThirdpartyTest.php +++ b/test/phpunit/WebservicesThirdpartyTest.php @@ -116,64 +116,64 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSThirdparty_xxx - * - * @return int - */ - public function testWSThirdparty_xxx() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } - + + /** + * testWSThirdparty_xxx + * + * @return int + */ + public function testWSThirdparty_xxx() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } + } ?> \ No newline at end of file diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index 5cfa0f735f1..9ef2278015b 100755 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -116,64 +116,64 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - - /** - * testWSUser_xxx - * - * @return int - */ - public function testWSUser_xxx() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; - $WS_METHOD = 'xxx'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__."Call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
    \n\n"; - print $soapclient->request; - print "
    \n\n"; - print $soapclient->response; - exit; - } - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - - return $result; - } + + /** + * testWSUser_xxx + * + * @return int + */ + public function testWSUser_xxx() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; + $WS_METHOD = 'xxx'; + $ns='http://www.dolibarr.org/ns/'; + + // Set the WebService URL + print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; + $soapclient = new nusoap_client($WS_DOL_URL); + if ($soapclient) + { + $soapclient->soap_defencoding='UTF-8'; + $soapclient->decodeUTF8(false); + } + + // Call the WebService method and store its result in $result. + $authentication=array( + 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, + 'sourceapplication'=>'DEMO', + 'login'=>'admin', + 'password'=>'admin', + 'entity'=>''); + + // Test URL + if ($WS_METHOD) + { + $parameters = array('authentication'=>$authentication); + print __METHOD__."Call method ".$WS_METHOD."\n"; + $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); + if (! $result) + { + //var_dump($soapclient); + print $soapclient->error_str; + print "
    \n\n"; + print $soapclient->request; + print "
    \n\n"; + print $soapclient->response; + exit; + } + } + + print __METHOD__." result=".$result."\n"; + //$this->assertEquals('OK',$result['result']['result_code']); + + return $result; + } } ?> \ No newline at end of file From ee7490a30acb94c0d2a819224260831179d418e3 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sat, 30 Mar 2013 14:31:10 +0100 Subject: [PATCH 19/37] fix : language error --- htdocs/langs/bg_BG/errors.lang | 2 +- htdocs/langs/ca_ES/errors.lang | 2 +- htdocs/langs/en_US/errors.lang | 2 +- htdocs/langs/es_ES/errors.lang | 2 +- htdocs/langs/fr_FR/errors.lang | 2 +- htdocs/product/admin/product_tools.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/bg_BG/errors.lang b/htdocs/langs/bg_BG/errors.lang index 83d491cae38..9bf9742abdb 100644 --- a/htdocs/langs/bg_BG/errors.lang +++ b/htdocs/langs/bg_BG/errors.lang @@ -115,7 +115,7 @@ ErrorFileMustBeADolibarrPackage=Файлове %s трябва да бъде ц ErrorFileRequired=Отнема файла пакет Dolibarr ErrorPhpCurlNotInstalled=PHP навийте не е инсталиран, това е от съществено значение, за да разговаря с Paypal ErrorFailedToAddToMailmanList=Неуспешно добавяне на запис на пощальона списък или база СПИП -ErrorNewVaueCantMatchOldValue=Новата стойност не може да бъде равна на стария +ErrorNewValueCantMatchOldValue=Новата стойност не може да бъде равна на стария WarningMandatorySetupNotComplete=Задължителни параметри на настройката все още не са определени WarningSafeModeOnCheckExecDir=Внимание, PHP опция защитният режим е включен, така че командата трябва да бъдат съхранени в директория, декларирани с параметър PHP safe_mode_exec_dir. WarningAllowUrlFopenMustBeOn=Параметър allow_url_fopen трябва да бъде поставен в Filer php.ini за това, че този модул да работи напълно. Трябва да промените този файл ръчно. diff --git a/htdocs/langs/ca_ES/errors.lang b/htdocs/langs/ca_ES/errors.lang index 8fd41caa1ab..d6dce2cd433 100644 --- a/htdocs/langs/ca_ES/errors.lang +++ b/htdocs/langs/ca_ES/errors.lang @@ -116,7 +116,7 @@ ErrorFileMustBeADolibarrPackage=El fitxer %s ha de ser un paquet Dolibarr en for ErrorFileRequired=Es requereix un fitxer de paquet Dolibarr en format zip ErrorPhpCurlNotInstalled=L'extensió PHP CURL no es troba instal·lada, és indispensable per dialogar amb Paypal. ErrorFailedToAddToMailmanList=S'ha produït un error en intentar afegir un registre a la llista Mailman o base de dades SPIP -ErrorNewVaueCantMatchOldValue=El Nou valor no pot ser igual al antic +ErrorNewValueCantMatchOldValue=El Nou valor no pot ser igual al antic ErrorFailedToValidatePasswordReset=No s'ha pogut restablir la contrasenya. És possible que aquest enllaç ja s'hagi utilitzat (aquest enllaç només es pot utilitzar una vegada). Si no és el cas prova de reiniciar el procés de restabliment de contrasenya des del principi. # Warnings diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a4c5251bb69..3c7ecb50274 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -115,7 +115,7 @@ ErrorFileMustBeADolibarrPackage=The file %s must be a Dolibarr zip package ErrorFileRequired=It takes a package Dolibarr file ErrorPhpCurlNotInstalled=The PHP CURL is not installed, this is essential to talk with Paypal ErrorFailedToAddToMailmanList=Failed to add record to Mailman list or SPIP base -ErrorNewVaueCantMatchOldValue=New value can't be equal to old one +ErrorNewValueCantMatchOldValue=New value can't be equal to old one ErrorFailedToValidatePasswordReset=Failed to reinit password. May be the reinit was already done (this link can be used only one time). If not, try to restart the reinit process. # Warnings diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index d3c39094ef3..5a5ce7639d6 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -116,7 +116,7 @@ ErrorFileMustBeADolibarrPackage=El archivo %s debe ser un paquete Dolibarr en fo ErrorFileRequired=Se requiere un archivo de paquete Dolibarr en formato zip ErrorPhpCurlNotInstalled=La extensión PHP CURL no se encuentra instalada, es indispensable para dialogar con Paypal. ErrorFailedToAddToMailmanList=Ha ocurrido un error al intentar añadir un registro a la lista Mailman o base de datos SPIP -ErrorNewVaueCantMatchOldValue=El nuevo valor no puede ser igual al antiguo +ErrorNewValueCantMatchOldValue=El nuevo valor no puede ser igual al antiguo ErrorFailedToValidatePasswordReset=No se ha podido restablecer la contraseña. Es posible que este enlace ya se haya utilizado (este enlace sólo puede usarse una vez). Si no es el caso, trate de reiniciar el proceso de restablecimiento de contraseña desde el principio. # Warnings diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 3c7d1e275ed..bcc141dfdc6 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -116,7 +116,7 @@ ErrorFileMustBeADolibarrPackage=Le fichier doit être un package Dolibarr ErrorFileRequired=Il faut un fichier de package Dolibarr ErrorPhpCurlNotInstalled=L'extension PHP CURL n'est pas installée, ceci est indispensable pour dialoguer avec Paypal. ErrorFailedToAddToMailmanList=Echec de l'ajout à une liste Mailman ou base SPIP -ErrorNewVaueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'ancienne +ErrorNewValueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'ancienne ErrorFailedToValidatePasswordReset=Echec de la réinitialisation du mot de passe. Il est possible que ce lien ait déjà été utilisé (l'utilisation de ce lien ne fonctionne qu'une fois). Si ce n'est pas le cas, essayer de recommencer le processus de réinit de mot de passe depuis le début. # Warnings diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index d99ad64253d..3c17429e9c9 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -54,7 +54,7 @@ if ($action == 'convert') if ($oldvatrate == $newvatrate) { $langs->load("errors"); - setEventMessage($langs->trans("ErrorNewVaueCantMatchOldValue"),'errors'); + setEventMessage($langs->trans("ErrorNewValueCantMatchOldValue"),'errors'); $error++; } From 4208f11d8717744830fc546c3f19c0bd2399f5c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 15:57:54 +0100 Subject: [PATCH 20/37] Enhance fixutf8bomfiles and fixdosfiles tools. --- dev/findutf8bom.sh | 10 ------- dev/fixdosfiles.sh | 4 +-- dev/fixutf8bomfiles.sh | 33 ++++++++++++++++++++++ dev/removeutf8bom.sh | 15 ---------- htdocs/core/login/README.txt | 52 +++++++++++++++++------------------ htdocs/langs/pt_PT/admin.lang | 2 +- 6 files changed, 62 insertions(+), 54 deletions(-) delete mode 100755 dev/findutf8bom.sh create mode 100755 dev/fixutf8bomfiles.sh delete mode 100755 dev/removeutf8bom.sh diff --git a/dev/findutf8bom.sh b/dev/findutf8bom.sh deleted file mode 100755 index b7e290fec84..00000000000 --- a/dev/findutf8bom.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# Checks if files contains UTF-8 BOM -# in dolibarr source tree excluding -# git repository, custom modules and incuded libraries -# -# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr -grep -rlI \ ---exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' \ -$'\xEF\xBB\xBF' . diff --git a/dev/fixdosfiles.sh b/dev/fixdosfiles.sh index da1e1a12af5..ac4a305834c 100755 --- a/dev/fixdosfiles.sh +++ b/dev/fixdosfiles.sh @@ -16,13 +16,13 @@ fi # To detec if [ "x$1" = "xlist" ] then - find . -type f -iname "*.php" -exec file "{}" + | grep CRLF + find . -iname "*.php" -o -iname "*.sh" -o -iname "*.pl" -o -iname "*.lang" -o -iname "*.txt" -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF fi # To convert if [ "x$1" = "xfix" ] then - for fic in `find . -type f -iname "*.php" -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' ` + for fic in `find . -iname "*.php" -o -iname "*.sh" -o -iname "*.pl" -o -iname "*.lang" -o -iname "*.txt" -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF | awk -F':' '{ print $1 }' ` do echo "Fix file $fic" dos2unix $fic diff --git a/dev/fixutf8bomfiles.sh b/dev/fixutf8bomfiles.sh new file mode 100755 index 00000000000..058c1c8a483 --- /dev/null +++ b/dev/fixutf8bomfiles.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Checks of fix files contains UTF-8 BOM in dolibarr source tree, +# excluding git repository, custom modules and included libraries. +# +# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr +# Laurent Destailleur eldy@users.sourceforge.net +#------------------------------------------------------ +# Usage: fixutf8bomfiles.sh [list|fix] +#------------------------------------------------------ + +# Syntax +if [ "x$1" != "xlist" -a "x$1" != "xfix" ] +then + echo "Usage: fixutf8bomfiles.sh [list|fix]" +fi + +# To detec +if [ "x$1" = "xlist" ] +then + #find . -iname '*.php' -print0 -o -iname '*.sh' -print0 -o -iname '*.pl' -print0 -o -iname '*.lang' -print0 -o -iname '*.txt' -print0 | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}' + grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}' +fi + +# To convert +if [ "x$1" = "xfix" ] +then + for fic in `grep -rlIZ --include='*.php' --include='*.sh' --include='*.pl' --include='*.lang' --include='*.txt' --exclude-dir='.git' --exclude-dir='includes' --exclude-dir='custom' . . | xargs -0 awk '/^\xEF\xBB\xBF/ {print FILENAME} {nextfile}'` + do + echo "Fixing $fic" + sed -i '1s/^\xEF\xBB\xBF//' $fic + done; +fi diff --git a/dev/removeutf8bom.sh b/dev/removeutf8bom.sh deleted file mode 100755 index 54924c51d49..00000000000 --- a/dev/removeutf8bom.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Removes UTF-8 BOM from a file list on STDIN -# Use by piping the output of a findutf8bom script -# -# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr -# -# Example: -# cd dirwithfiles -# ls | /path/dev/removeutf8bom.sh - -while read f; do - echo "Fixing $f" - sed -i '1s/^\xEF\xBB\xBF//' $f -done diff --git a/htdocs/core/login/README.txt b/htdocs/core/login/README.txt index 7c00a86887f..8128dfacd57 100644 --- a/htdocs/core/login/README.txt +++ b/htdocs/core/login/README.txt @@ -1,26 +1,26 @@ -README (english) ---------------------------------------------- -Decription of htdocs/core/login directory ---------------------------------------------- - -This directory contains files that handle way to validate passwords. - -If you want to add a new password checker function, just add a file in -this directory that follow example of already existing files. -This file must be called for example : -functions_mypasschecker.php - -Edit function name to call it: -check_user_mypasschecker - -Change code of this function to return true if couple -$usertotest / $passwordtotest is ok for you. - -Then, you must edit you conf.php file to change the value of -$dolibarr_main_authentication -parameter to set it to : -mypasschecker - -Once this is done, when you log in to Dolibarr, the function -check_user_mypasschecker in this file is called. -If the function return true and login exists, login is accepted. +README (english) +--------------------------------------------- +Decription of htdocs/core/login directory +--------------------------------------------- + +This directory contains files that handle way to validate passwords. + +If you want to add a new password checker function, just add a file in +this directory that follow example of already existing files. +This file must be called for example : +functions_mypasschecker.php + +Edit function name to call it: +check_user_mypasschecker + +Change code of this function to return true if couple +$usertotest / $passwordtotest is ok for you. + +Then, you must edit you conf.php file to change the value of +$dolibarr_main_authentication +parameter to set it to : +mypasschecker + +Once this is done, when you log in to Dolibarr, the function +check_user_mypasschecker in this file is called. +If the function return true and login exists, login is accepted. diff --git a/htdocs/langs/pt_PT/admin.lang b/htdocs/langs/pt_PT/admin.lang index a3de0cb68dd..a1af76ae0c1 100644 --- a/htdocs/langs/pt_PT/admin.lang +++ b/htdocs/langs/pt_PT/admin.lang @@ -1,5 +1,5 @@ # Dolibarr language file - pt_PT - admin -CHARSET = UTF-8 +CHARSET = UTF-8 AccountCodeManager = Módulo de geração dos códigos contabilisticos (Clientes/Fornecedores) ActivateFCKeditor = Activar FCKeditor para : ActivateOn = Activar sobre From 000fe2c864a13f0472e6a85f3d67610764c6a937 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 18:04:33 +0100 Subject: [PATCH 21/37] New: Better error management for add/remove of memeber into mailman. --- htdocs/adherents/class/adherent.class.php | 37 ++++++++++++++++--- htdocs/adherents/fiche.php | 21 ++++++++--- htdocs/langs/en_US/errors.lang | 3 +- htdocs/langs/en_US/mailmanspip.lang | 4 +- htdocs/langs/fr_FR/errors.lang | 3 +- htdocs/langs/fr_FR/mailmanspip.lang | 3 ++ .../mailmanspip/class/mailmanspip.class.php | 26 ++++++++++++- 7 files changed, 81 insertions(+), 16 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 3527535809b..f222d6e63e5 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -41,6 +41,10 @@ class Adherent extends CommonObject public $table_element='adherent'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + var $error; + var $errors; + var $mesgs; + var $id; var $ref; var $civilite_id; @@ -1370,10 +1374,10 @@ class Adherent extends CommonObject */ function add_to_abo() { - global $conf; + global $conf,$langs; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; - $mailmanspip=new MailmanSpip($db); + $mailmanspip=new MailmanSpip($this->db); $err=0; @@ -1386,6 +1390,16 @@ class Adherent extends CommonObject $this->error=$mailmanspip->error; $err+=1; } + foreach ($mailmanspip->mladded_ko as $tmplist => $tmpemail) + { + $langs->load("errors"); + $this->errors[]=$langs->trans("ErrorFailedToAddToMailmanList",$tmpemail,$tmplist); + } + foreach ($mailmanspip->mladded_ok as $tmplist => $tmpemail) + { + $langs->load("mailmanspip"); + $this->mesgs[]=$langs->trans("SuccessToAddToMailmanList",$tmpemail,$tmplist); + } } // spip @@ -1400,11 +1414,10 @@ class Adherent extends CommonObject } if ($err) { - // error return -$err; } else - { + { return 1; } } @@ -1418,10 +1431,10 @@ class Adherent extends CommonObject */ function del_to_abo() { - global $conf; + global $conf,$langs; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; - $mailmanspip=new MailmanSpip($db); + $mailmanspip=new MailmanSpip($this->db); $err=0; @@ -1431,8 +1444,20 @@ class Adherent extends CommonObject $result=$mailmanspip->del_to_mailman($this); if ($result < 0) { + $this->error=$mailmanspip->error; $err+=1; } + + foreach ($mailmanspip->mlremoved_ko as $tmplist => $tmpemail) + { + $langs->load("errors"); + $this->errors[]=$langs->trans("ErrorFailedToRemoveToMailmanList",$tmpemail,$tmplist); + } + foreach ($mailmanspip->mlremoved_ok as $tmplist => $tmpemail) + { + $langs->load("mailmanspip"); + $this->mesgs[]=$langs->trans("SuccessToRemoveToMailmanList",$tmpemail,$tmplist); + } } if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled)) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 787cad2664f..d34da06987d 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -356,15 +356,24 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) { if ($object->oldcopy->del_to_abo() < 0) { - // error - $errmsgs[]= $langs->trans("FailedToCleanMailmanList").': '.$object->error."
    \n"; + if (! empty($object->oldcopy->error)) setEventMessage($langs->trans("ErrorFailedToRemoveToMailmanList").': '.$object->oldcopy->error, 'errors'); + setEventMessage($object->oldcopy->errors, 'errors'); + } + else + { + setEventMessage($object->oldcopy->mesgs,'mesgs'); } } - if ($object->add_to_abo() < 0) // We add subscription if new email or new type (new type may means more mailing-list to subscribe) + // We add subscription if new email or new type (new type may means more mailing-list to subscribe) + if ($object->add_to_abo() < 0) + { + if (! empty($object->error)) setEventMessage($langs->trans("ErrorFailedToAddToMailmanList").': '.$object->error, 'errors'); + setEventMessage($object->errors, 'errors'); + } + else { - // error - $errmsgs[]= $langs->trans("FailedToAddToMailmanList").': '.$object->error."
    \n"; - } + setEventMessage($object->mesgs, 'mesgs'); + } } $rowid=$object->id; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 3c7ecb50274..d66449ecf5d 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -114,7 +114,8 @@ ErrNoZipEngine=No engine to unzip %s file in this PHP ErrorFileMustBeADolibarrPackage=The file %s must be a Dolibarr zip package ErrorFileRequired=It takes a package Dolibarr file ErrorPhpCurlNotInstalled=The PHP CURL is not installed, this is essential to talk with Paypal -ErrorFailedToAddToMailmanList=Failed to add record to Mailman list or SPIP base +ErrorFailedToAddToMailmanList=Failed to add record %s to Mailman list %s or SPIP base +ErrorFailedToRemoveToMailmanList=Failed to remove record %s to Mailman list %s or SPIP base ErrorNewValueCantMatchOldValue=New value can't be equal to old one ErrorFailedToValidatePasswordReset=Failed to reinit password. May be the reinit was already done (this link can be used only one time). If not, try to restart the reinit process. diff --git a/htdocs/langs/en_US/mailmanspip.lang b/htdocs/langs/en_US/mailmanspip.lang index 18f1a684c7a..50887cc082e 100644 --- a/htdocs/langs/en_US/mailmanspip.lang +++ b/htdocs/langs/en_US/mailmanspip.lang @@ -23,4 +23,6 @@ AddIntoSpipError=Failed to add the user in SPIP DeleteIntoSpip=Remove from SPIP DeleteIntoSpipConfirmation=Are you sure you want to remove this member from SPIP? DeleteIntoSpipError=Failed to suppress the user from SPIP -SPIPConnectionFailed=Failed to connect to SPIP \ No newline at end of file +SPIPConnectionFailed=Failed to connect to SPIP +SuccessToAddToMailmanList=Add of %s to mailman list %s or SPIP database done +SuccessToRemoveToMailmanList=Removal of %s from mailman list %s or SPIP database done \ No newline at end of file diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index bcc141dfdc6..8110d224355 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -115,7 +115,8 @@ ErrNoZipEngine=Pas de moteur pour décompresser le fichier %s dans ce PHP ErrorFileMustBeADolibarrPackage=Le fichier doit être un package Dolibarr ErrorFileRequired=Il faut un fichier de package Dolibarr ErrorPhpCurlNotInstalled=L'extension PHP CURL n'est pas installée, ceci est indispensable pour dialoguer avec Paypal. -ErrorFailedToAddToMailmanList=Echec de l'ajout à une liste Mailman ou base SPIP +ErrorFailedToAddToMailmanList=Echec de l'ajout de %s à la liste Mailman %s ou base SPIP +ErrorFailedToRemoveToMailmanList=Echec de la suppression de %s de la liste Mailman %s ou base SPIP ErrorNewValueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'ancienne ErrorFailedToValidatePasswordReset=Echec de la réinitialisation du mot de passe. Il est possible que ce lien ait déjà été utilisé (l'utilisation de ce lien ne fonctionne qu'une fois). Si ce n'est pas le cas, essayer de recommencer le processus de réinit de mot de passe depuis le début. diff --git a/htdocs/langs/fr_FR/mailmanspip.lang b/htdocs/langs/fr_FR/mailmanspip.lang index ac88688a3bd..3f27ae0d9c9 100644 --- a/htdocs/langs/fr_FR/mailmanspip.lang +++ b/htdocs/langs/fr_FR/mailmanspip.lang @@ -23,3 +23,6 @@ DeleteIntoSpip=Supprimer de spip DeleteIntoSpipConfirmation=Êtes-vous sur de vouloir effacer cet adhérent de SPIP? DeleteIntoSpipError=Échec de la suppression de l'utilisateur de SPIP SPIPConnectionFailed=Échec de connexion à SPIP +SuccessToAddToMailmanList=Ajout de %s à la liste Mailman %s ou base SPIP réalisé +SuccessToRemoveToMailmanList=Suppression de %s de la liste Mailman %s ou base SPIP réalisé + diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index 9e10c315dfa..5a015ba1c64 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -40,6 +40,11 @@ class MailmanSpip var $db; var $error; + var $mladded_ok; + var $mladded_ko; + var $mlremoved_ok; + var $mlremoved_ko; + /** * Constructor @@ -299,6 +304,9 @@ class MailmanSpip dol_syslog(get_class($this)."::add_to_mailman"); + $this->mladded_ok=array(); + $this->mladded_ko=array(); + if (! function_exists("curl_init")) { $langs->load("errors"); @@ -335,13 +343,15 @@ class MailmanSpip if ($result === false) { + $this->mladded_ko[$list]=$object->email; return -2; } + else $this->mladded_ok[$list]=$object->email; } return count($lists); } else - { + { $this->error="ADHERENT_MAILMAN_URL not defined"; return -1; } @@ -359,6 +369,18 @@ class MailmanSpip { global $conf,$langs,$user; + dol_syslog(get_class($this)."::del_to_mailman"); + + $this->mlremoved_ok=array(); + $this->mlremoved_ko=array(); + + if (! function_exists("curl_init")) + { + $langs->load("errors"); + $this->error=$langs->trans("ErrorFunctionNotAvailableInPHP","curl_init"); + return -1; + } + if (! empty($conf->global->ADHERENT_MAILMAN_UNSUB_URL)) { if ($listes=='' && ! empty($conf->global->ADHERENT_MAILMAN_LISTS)) @@ -388,8 +410,10 @@ class MailmanSpip if ($result === false) { + $this->mlremoved_ko[$list]=$object->email; return -2; } + else $this->mlremoved_ok[$list]=$object->email; } return count($lists); } From 4c1f17f42f4e802e1ce1f3611410151e24e7e576 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 19:11:52 +0100 Subject: [PATCH 22/37] Qual: More robust error management for menu description --- htdocs/core/modules/DolibarrModules.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 80becf69573..1885662a512 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -433,7 +433,7 @@ abstract class DolibarrModules if (is_resource($handle)) { $dirfound++; - + // Run llx_mytable.sql files while (($file = readdir($handle))!==false) { @@ -443,7 +443,7 @@ abstract class DolibarrModules if ($result <= 0) $error++; } } - + rewinddir($handle); // Run llx_mytable.key.sql files (Must be done after llx_mytable.sql) @@ -457,7 +457,7 @@ abstract class DolibarrModules } rewinddir($handle); - + // Run data_xxx.sql files (Must be done after llx_mytable.key.sql) while (($file = readdir($handle))!==false) { @@ -467,9 +467,9 @@ abstract class DolibarrModules if ($result <= 0) $error++; } } - + rewinddir($handle); - + // Run update_xxx.sql files while (($file = readdir($handle))!==false) { @@ -479,7 +479,7 @@ abstract class DolibarrModules if ($result <= 0) $error++; } } - + closedir($handle); } @@ -990,7 +990,7 @@ abstract class DolibarrModules //print 'xxx'.$this->menu[$key]['fk_menu'];exit; $foundparent=0; $fk_parent=$this->menu[$key]['fk_menu']; - if (preg_match('/r=/',$fk_parent)) + if (preg_match('/^r=/',$fk_parent)) // old deprecated method { $fk_parent=str_replace('r=','',$fk_parent); if (isset($this->menu[$fk_parent]['rowid'])) @@ -999,14 +999,14 @@ abstract class DolibarrModules $foundparent=1; } } - elseif (preg_match('/fk_mainmenu=(.*),fk_leftmenu=(.*)/',$fk_parent,$reg)) + elseif (preg_match('/^fk_mainmenu=([a-zA-Z0-9_]+),fk_leftmenu=([a-zA-Z0-9_]+)$/',$fk_parent,$reg)) { $menu->fk_menu=-1; $menu->fk_mainmenu=$reg[1]; $menu->fk_leftmenu=$reg[2]; $foundparent=1; } - elseif (preg_match('/fk_mainmenu=(.*)/',$fk_parent,$reg)) + elseif (preg_match('/^fk_mainmenu=([a-zA-Z0-9_]+)$/',$fk_parent,$reg)) { $menu->fk_menu=-1; $menu->fk_mainmenu=$reg[1]; From fe895adb95732d334ebeb0837e69e4c956cd7e33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 19:37:09 +0100 Subject: [PATCH 23/37] Fix: Bad div --- htdocs/categories/index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index aeed1760f00..4e9f376977c 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -121,12 +121,13 @@ if ($catname || $id > 0) } print ""; } +else print ' '; //print ''; -print '
    '; +print ''; -print '
    '; +print '

    '; // Charge tableau des categories @@ -187,6 +188,7 @@ else print ""; +print '
    '; llxFooter(); From f52fe71018286ee5d469d60276f7b26976f92529 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 19:40:52 +0100 Subject: [PATCH 24/37] Fix: Bad div closing --- htdocs/adherents/index.php | 2 +- htdocs/comm/index.php | 2 +- htdocs/comm/mailing/index.php | 2 +- htdocs/comm/propal/index.php | 2 +- htdocs/comm/prospect/index.php | 2 +- htdocs/commande/index.php | 2 +- htdocs/compta/index.php | 2 +- htdocs/compta/paiement/cheque/index.php | 2 +- htdocs/compta/prelevement/index.php | 2 +- htdocs/compta/ventilation/index.php | 2 +- htdocs/contrat/index.php | 2 +- htdocs/expedition/index.php | 2 +- htdocs/fourn/index.php | 2 +- htdocs/product/index.php | 2 +- htdocs/product/stock/index.php | 2 +- htdocs/societe/index.php | 2 +- htdocs/user/home.php | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index fc5994f3086..27b3403efa0 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -419,7 +419,7 @@ print "\n"; print "
    \n"; //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index d3acdd87593..48a07dcacba 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -546,7 +546,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index fd12402f050..8ef75c9712d 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -201,7 +201,7 @@ else //print ''; -print '
    '; +print ''; if ($langs->file_exists("html/spam.html",0)) { diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 6347f68c87a..971f6d10a86 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -513,7 +513,7 @@ if (! empty($conf->propal->enabled)) */ //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index e08228b5c61..e6496c32a58 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -279,7 +279,7 @@ if ($resql) //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index cb6e85ac117..e0e2e09df73 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -425,7 +425,7 @@ if (! empty($conf->commande->enabled)) //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 925e55f02fc..ec2dc5997e2 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -1033,7 +1033,7 @@ if ($resql) } //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index ac67e103a82..b3ccf19ae19 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -146,7 +146,7 @@ else //print "\n"; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 916c3fccec5..100a6eb0861 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -221,7 +221,7 @@ else //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/compta/ventilation/index.php b/htdocs/compta/ventilation/index.php index 316f5c41e1e..f98b3ed7ac1 100644 --- a/htdocs/compta/ventilation/index.php +++ b/htdocs/compta/ventilation/index.php @@ -94,7 +94,7 @@ if ($resql) print "\n"; //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index bd35af4d55b..2e9ab1b1cb6 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -604,7 +604,7 @@ else //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 961365ca15e..1d4fc31d706 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -275,7 +275,7 @@ else dol_print_error($db); //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index a4a9e06ccef..25f781ccf0d 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -321,7 +321,7 @@ if (count($companystatic->SupplierCategories)) //print "\n"; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 8e3c3e795fd..e973516f5f9 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -259,7 +259,7 @@ else } //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index beb4c7829ba..a25e1e4357d 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -164,7 +164,7 @@ if ($resql) } //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 74d8b74c4d4..90513c239de 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -249,7 +249,7 @@ else } //print ''; -print '
    '; +print ''; llxFooter(); diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 8c2de389a39..537a4671b5a 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -254,7 +254,7 @@ if ($canreadperms) } //print ''; -print '
    '; +print ''; llxFooter(); From 0b9602e4e6373136fad124f6a7ffdd14a91bacd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 20:32:50 +0100 Subject: [PATCH 25/37] Optionnal entries at end --- htdocs/main.inc.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d94fcab199d..3f3695c7d27 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1516,6 +1516,19 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me print "\n"; } + //Dolibarr version + $doliurl='http://www.dolibarr.org'; + $appli='Dolibarr'; + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { + $appli=$conf->global->MAIN_APPLICATION_TITLE; $doliurl=''; + } + $appli.=" ".DOL_VERSION; + print '
    '; + if ($doliurl) print ''; + print $appli; + if ($doliurlx) print ''; + print '
    '; + // Link to Dolibarr wiki pages if ($helppagename && empty($conf->global->MAIN_HELP_DISABLELINK)) { @@ -1566,18 +1579,6 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me } print "\n"; - //Dolibarr version - $doliurl='http://www.dolibarr.org'; - $appli='Dolibarr'; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { $appli=$conf->global->MAIN_APPLICATION_TITLE; $doliurl=''; } - $appli.=" ".DOL_VERSION; - - print '
    '; - if ($doliurl) print ''; - print $appli; - if ($doliurlx) print ''; - print '
    '; - print "\n"; print "\n"; From 79f40f27b31a3f693fd94d4d757ee57e3a1d01cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 20:33:42 +0100 Subject: [PATCH 26/37] Removed entry specific to external module --- htdocs/theme/eldy/style.css.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0cd62a11591..eb5d6b058f6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -596,10 +596,6 @@ div.mainmenu.companies { background-image: url(); } -div.mainmenu.contacts { - background-image: url(); -} - div.mainmenu.commercial { background-image: url(); } @@ -2543,7 +2539,7 @@ div.dolEventError h1, div.dolEventError h2 { background-image: -ms-linear-gradient(top,#fdfdfd,#aaa) !important; background-image: -o-linear-gradient(top,#fdfdfd,#aaa) !important; background-image: linear-gradient(top,#fdfdfd,#aaa) !important; -} +} .ui-bar-b .ui-link { border: none; font-weight: bold !important; From ef571de960ae7d506588b2aabc10b0734b537baa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 20:34:13 +0100 Subject: [PATCH 27/37] New: Support __USERID__ into menu entries --- htdocs/core/menus/standard/auguria.lib.php | 8 +++++--- htdocs/core/menus/standard/eldy.lib.php | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index ebf70b6d9c9..068ff241f49 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -76,7 +76,9 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } $url=preg_replace('/__LOGIN__/',$user->login,$url); $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); - + $url=preg_replace('/__USERID__/',$user->id,$url); + $shorturl=preg_replace('/__USERID__/',$user->id,$shorturl); + // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; else if (! empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname='class="tmenusel"'; @@ -256,7 +258,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM { $showmenu=true; if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false; - + $alt++; if (empty($menu_array[$i]['level']) && $showmenu) { @@ -335,7 +337,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM } } } - + return count($menu_array); } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 42ab594b387..34ac773b1d1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -280,6 +280,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } $url=preg_replace('/__LOGIN__/',$user->login,$url); $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); + $url=preg_replace('/__USERID__/',$user->id,$url); + $shorturl=preg_replace('/__USERID__/',$user->id,$shorturl); // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; @@ -414,7 +416,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]); $leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"])); - + // Show logo company if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO)) { @@ -1206,6 +1208,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // For external modules $url = dol_buildpath($menu_array[$i]['url'], 1); + $url=preg_replace('/__LOGIN__/',$user->login,$url); + $url=preg_replace('/__USERID__/',$user->id,$url); print ''."\n"; From a5799b3ae8e55c584836ac8aacf7c8d8a194b36b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 21:25:00 +0100 Subject: [PATCH 28/37] Trans for SMS --- htdocs/core/menus/init_menu_auguria.sql | 22 +++++++++++----------- htdocs/langs/fr_FR/admin.lang | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 733dc0a54d7..9beedd143be 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -8,16 +8,16 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- -- table llx_menu -- -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '$conf->societe->enabled || $conf->fournisseur->enabled', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 3, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|deplacement|don|tax', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->deplacement->lire || $user->rights->don->lire || $user->rights->tax->charges->lire', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 6, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 7, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run', '', 2, 8, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('boutique', '! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, __HANDLER__, 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 11, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 15, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '$conf->societe->enabled || $conf->fournisseur->enabled', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|deplacement|don|tax', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->deplacement->lire || $user->rights->don->lire || $user->rights->tax->charges->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run', '', 2, 80, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('boutique', '! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, __HANDLER__, 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 90, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 100, __ENTITY__); -- Home - Setup insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 101__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/company.php?leftmenu=setup', 'MenuCompanySetup', 1, 'admin', '', '', 2, 1, __ENTITY__); @@ -30,7 +30,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 110__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/limits.php?leftmenu=setup', 'MenuLimits', 1, 'admin', '', '', 2, 8, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 107__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/pdf.php?leftmenu=setup', 'PDF', 1, 'admin', '', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 109__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/mails.php?leftmenu=setup', 'Emails', 1, 'admin', '', '', 2, 10, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?leftmenu=setup', 'Sms', 1, 'admin', '', '', 2, 11, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?leftmenu=setup', 'SMS', 1, 'admin', '', '', 2, 11, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 111__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/dict.php?leftmenu=setup', 'DictionnarySetup', 1, 'admin', '', '', 2, 12, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu==\'setup\'', __HANDLER__, 'left', 112__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/const.php?leftmenu=setup', 'OtherSetup', 1, 'admin', '', '', 2, 13, __ENTITY__); -- Home - Sytem info diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index e688d9eab8c..ecc78fc4273 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -359,6 +359,7 @@ LibraryToBuildPDF=Bibliothèque utilisée pour la génération des PDF WarningUsingFPDF=Attention: Votre fichier conf.php contient la directive dolibarr_pdf_force_fpdf=1. Cela signifie que vous utilisez la librairie FPDF pour générer vos fichiers PDF. Cette librairie est ancienne et ne couvre pas de nombreuses fonctionnalitée (Unicode, transparence des images, langues cyrillic, arabes ou asiatiques...), aussi vous pouvez rencontrez des problèmes durant la génération des PDF.
    Pour résoudre cela et avoir un support complet de PDF, vous pouvez télécharger la librairie TCPDF puis commenter ou supprimer la ligne $dolibarr_pdf_force_fpdf=1, et ajouter à la place $dolibarr_lib_TCPDF_PATH='chemin_vers_TCPDF' LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:
    1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)
    2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)
    3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)
    4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)
    5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)
    6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale) SuhosinSessionEncrypt=Stockage des sessions encryptés par Suhosin +SMS=SMS # Modules= undefined Module0Name= Utilisateurs & groupes From fa6e9d2d47db19c0c06e2d1e438b47fa4e217b83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 21:25:37 +0100 Subject: [PATCH 29/37] Missing trans key --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2a010d4733b..c46ab4545c8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -360,6 +360,7 @@ ExtrafieldSelect = Select list LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
    To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
    1 : local tax apply on products and services without vat (vat is not applied on local tax)
    2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)
    3 : local tax apply on products without vat (vat is not applied on local tax)
    4 : local tax apply on products before vat (vat is calculated on amount + localtax)
    5 : local tax apply on services without vat (vat is not applied on local tax)
    6 : local tax apply on services before vat (vat is calculated on amount + localtax) +SMS=SMS # Modules Module0Name=Users & groups From dca3179bfece97185dccebd2d727559da4dadc7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2013 21:29:14 +0100 Subject: [PATCH 30/37] New: Support __LOGIN__ and __USERID__ on left menu entries --- htdocs/core/menus/standard/auguria.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 068ff241f49..1a40de3c713 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -285,6 +285,8 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM // Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser. $url=dol_buildpath($menu_array[$i]['url'],1); + $url=preg_replace('/__LOGIN__/',$user->login,$url); + $url=preg_replace('/__USERID__/',$user->id,$url); if (! preg_match('/mainmenu=/i',$menu_array[$i]['url'])) { From 294a085047e0b9c177e51ab12702de54e71096f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 04:03:08 +0200 Subject: [PATCH 31/37] New: ClickToDial setup is easier --- htdocs/admin/clicktodial.php | 39 +++++++++++++++++++++++-------- htdocs/core/lib/functions.lib.php | 9 +++---- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/errors.lang | 3 ++- htdocs/langs/fr_FR/admin.lang | 1 + htdocs/langs/fr_FR/errors.lang | 3 ++- htdocs/user/class/user.class.php | 4 ++++ scripts/clicktodial/linphone.sh | 11 +++++++++ 8 files changed, 55 insertions(+), 16 deletions(-) create mode 100755 scripts/clicktodial/linphone.sh diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 05d35049061..99241a8342f 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -69,7 +69,7 @@ print ''; $var=true; -print ''; +print '
    '; print ''; print ''; print ''; @@ -83,19 +83,38 @@ print $langs->trans("ClickToDialUrlDesc").'
    '; print $langs->trans("Example").':
    http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; print ''; -print ''; -print '
    '.$langs->trans("Name").''.$langs->trans("Value").'

    '; +print ''; -/*if (! empty($conf->global->CLICKTODIAL_URL)) - { - print $langs->trans("Test"); - // Add a phone number to test - } - */ +print '

    '; + +print ''; + + +if (! empty($conf->global->CLICKTODIAL_URL)) +{ + $user->fetch_clicktodial(); + + print $langs->trans("LinkToTestClickToDial").' : '; + + $setupcomplete=1; + if (preg_match('/__LOGIN__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0; + if (preg_match('/__PASSWORD__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) $setupcomplete=0; + if (preg_match('/__PHONEFROM__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete=0; + + if ($setupcomplete) + { + print dol_print_phone($mysoc->phone, '', 0, 0, 'AC_TEL'); + } + else + { + $langs->load("errors"); + print '
    '.$langs->trans("WarningClickToDialUserSetupNotComplete").'
    '; + } +} dol_htmloutput_mesg($mesg); $db->close(); llxFooter(); -?> +?> \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d0ad263d71a..c1e4f2b61d1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1155,17 +1155,18 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid= * @param string $country Country code to use for formatting * @param int $cid Id of contact if known * @param int $socid Id of third party if known - * @param int $addlink 0=no link to create action - * @param string $separ separation between numbers for a better visibility example : xx.xx.xx.xx.xx + * @param int $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set) + * @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx * @return string Formated phone number */ -function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=" ") +function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" ") { - global $conf,$user,$langs; + global $conf,$user,$langs,$mysoc; // Clean phone parameter $phone = preg_replace("/[\s.-]/","",trim($phone)); if (empty($phone)) { return ''; } + if (empty($country)) $country=$mysoc->country_code; $newphone=$phone; if (strtoupper($country) == "FR") diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c46ab4545c8..fef12f037fa 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -361,6 +361,7 @@ LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
    To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
    1 : local tax apply on products and services without vat (vat is not applied on local tax)
    2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)
    3 : local tax apply on products without vat (vat is not applied on local tax)
    4 : local tax apply on products before vat (vat is calculated on amount + localtax)
    5 : local tax apply on services without vat (vat is not applied on local tax)
    6 : local tax apply on services before vat (vat is calculated on amount + localtax) SMS=SMS +LinkToTestClickToDial=Link to test the ClickToDial # Modules Module0Name=Users & groups diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index d66449ecf5d..184c6bcc325 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -132,4 +132,5 @@ WarningNoDocumentModelActivated=No model, for document generation, has been acti WarningLockFileDoesNotExists=Warning, once setup is finished, you must disable install/migrate tools by adding a file install.lock into directory %s. Missing this file is a security hole. WarningUntilDirRemoved=All security warnings (visible by admin users only) will remain active as long as the vulnerability is present (or that constant MAIN_REMOVE_INSTALL_WARNING is added in Setup->Other setup). WarningCloseAlways=Warning, closing is done even if amount differs between source and target elements. Enable this feature with caution. -WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. \ No newline at end of file +WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. +WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card). \ No newline at end of file diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index ecc78fc4273..6ffd8fba44a 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -360,6 +360,7 @@ WarningUsingFPDF=Attention: Votre fichier conf.php contient la directive LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:
    1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)
    2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)
    3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)
    4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)
    5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)
    6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale) SuhosinSessionEncrypt=Stockage des sessions encryptés par Suhosin SMS=SMS +LinkToTestClickToDial=Lien pour tester le ClickToDial # Modules= undefined Module0Name= Utilisateurs & groupes diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 8110d224355..576d9d4bcb6 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -133,4 +133,5 @@ WarningNoDocumentModelActivated=Aucun modèle, pour la génération de document, WarningLockFileDoesNotExists=Attention, une fois l'installation terminée, les outils d'installation/migration doivent être désactivés en ajoutant un fichier install.lock dans le répertoire %s. L'absence de ce fichier représente une faille de sécurité. WarningUntilDirRemoved=Les alertes de sécurité sont visibles par les administrateurs uniquement et resteront actives tant que la vulnérabilité sera avérée (ou que la constante MAIN_REMOVE_INSTALL_WARNING aura été définie dans Configuration->Divers) WarningCloseAlways=Attention, la fermeture se fait même lorsque le montant diffère. N'activez cette fonctionnalité qu'en connaissance de cause. -WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boite provoque de sérieux ralentissement des pages affichant cette boite. \ No newline at end of file +WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boite provoque de sérieux ralentissement des pages affichant cette boite. +WarningClickToDialUserSetupNotComplete=La configuration ClickToDial pour votre compte utilisateur n'est pas complète (voir l'onglet ClickToDial sur votre fiche utilisateur) \ No newline at end of file diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c04f96b09db..de4876bd275 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -81,6 +81,10 @@ class User extends CommonObject var $phenix_pass; var $phenix_pass_crypted; + var $clicktodial_login; + var $clicktodial_password; + var $clicktodial_poste; + var $datelastlogin; var $datepreviouslogin; var $statut; diff --git a/scripts/clicktodial/linphone.sh b/scripts/clicktodial/linphone.sh new file mode 100755 index 00000000000..b2dc13e77e8 --- /dev/null +++ b/scripts/clicktodial/linphone.sh @@ -0,0 +1,11 @@ +#!/bin/bash +#--------------------------------------------------------- +# Script to launch LinPhone softphone. +# This script can be used to setup a ClickToDial system +# when using LinPhone soft phone. +# More information on http://wiki.dolibarr.org/index.php/Module_ClickToDial_En +#--------------------------------------------------------- + +echo Launch Linphone $1 $2 +param=`echo $1 | sed -s 's/^sip:[\/]*//' ` +/usr/bin/linphone-3 -c $param From a0dc4ae62ebeafb17ce86a177ed701ee7395b1af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 04:12:20 +0200 Subject: [PATCH 32/37] Avoid terminal --- scripts/clicktodial/linphone.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/clicktodial/linphone.sh b/scripts/clicktodial/linphone.sh index b2dc13e77e8..97c3bcb18d7 100755 --- a/scripts/clicktodial/linphone.sh +++ b/scripts/clicktodial/linphone.sh @@ -6,6 +6,13 @@ # More information on http://wiki.dolibarr.org/index.php/Module_ClickToDial_En #--------------------------------------------------------- +# Note: Adding handler into gconf-tools seems to do nothing +# gconftool-2 -t string -s /desktop/gnome/url-handlers/sip/command "linphone-3 -c %s" +# gconftool-2 -s /desktop/gnome/url-handlers/sip/needs_terminal false -t bool +# gconftool-2 -t bool -s /desktop/gnome/url-handlers/sip/enabled true + echo Launch Linphone $1 $2 + param=`echo $1 | sed -s 's/^sip:[\/]*//' ` -/usr/bin/linphone-3 -c $param + +/usr/bin/linphone-3 -c $param & From cc69cf7b76bb5cbd4b39316403ea3d830eaa7a21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 16:44:24 +0200 Subject: [PATCH 33/37] New: Can defined a clicktodial setup per user --- ChangeLog | 1 + htdocs/admin/clicktodial.php | 27 +++++++++--- htdocs/core/lib/functions.lib.php | 9 ++-- .../install/mysql/migration/3.3.0-3.4.0.sql | 2 + .../mysql/tables/llx_user_clicktodial.sql | 1 + htdocs/langs/en_US/admin.lang | 7 ++- htdocs/langs/fr_FR/admin.lang | 7 ++- htdocs/user/class/user.class.php | 20 +++++---- htdocs/user/clicktodial.php | 43 ++++++++++++------- 9 files changed, 84 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index db9fc3b9f8e..ab1fe32aa8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,7 @@ For users: - New: [ task #748 ] Add a link "Dolibarr" into left menu - New: Script email_unpaid_invoices_to_representative accepts now a parameter test and a delay. +- New: Can define a different clicktodial setup per user. - First change to prepare feature click to print for PDF. For translators: diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 99241a8342f..0ddd7f1abdc 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -38,7 +38,7 @@ $action = GETPOST("action"); */ if ($action == 'setvalue' && $user->admin) { - $result=dolibarr_set_const($db, "CLICKTODIAL_URL",GETPOST("url"),'chaine',0,'',$conf->entity); + $result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("url"), 'chaine', 0, '', $conf->entity); if ($result >= 0) { $mesg = "".$langs->trans("SetupSaved").""; @@ -54,6 +54,8 @@ if ($action == 'setvalue' && $user->admin) * View */ +$user->fetch_clicktodial(); + $wikihelp='EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es'; llxHeader('',$langs->trans("ClickToDialSetup"),$wikihelp); @@ -76,11 +78,18 @@ print ''.$langs->trans("Value").''; print "\n"; $var=!$var; print ''; -print $langs->trans("URL").''; +print $langs->trans("DefaultLink").''; print '
    '; print '
    '; print $langs->trans("ClickToDialUrlDesc").'
    '; print $langs->trans("Example").':
    http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; + +if (! empty($user->clicktodial_url)) +{ + print '
    '; + print info_admin($langs->trans("ValueOverwrittenByUserSetup")); +} + print ''; print ''; @@ -94,7 +103,14 @@ if (! empty($conf->global->CLICKTODIAL_URL)) { $user->fetch_clicktodial(); - print $langs->trans("LinkToTestClickToDial").' : '; + $phonefortest=$mysoc->phone; + if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest'); + + print '
    '; + print $langs->trans("LinkToTestClickToDial",$user->login).' : '; + print ''; + print ''; + print '
    '; $setupcomplete=1; if (preg_match('/__LOGIN__/',$conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0; @@ -103,7 +119,7 @@ if (! empty($conf->global->CLICKTODIAL_URL)) if ($setupcomplete) { - print dol_print_phone($mysoc->phone, '', 0, 0, 'AC_TEL'); + print $langs->trans("LinkToTest",$user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL'); } else { @@ -114,7 +130,8 @@ if (! empty($conf->global->CLICKTODIAL_URL)) dol_htmloutput_mesg($mesg); -$db->close(); llxFooter(); + +$db->close(); ?> \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c1e4f2b61d1..656841297ad 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1199,8 +1199,11 @@ function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" { if (empty($user->clicktodial_loaded)) $user->fetch_clicktodial(); - if (empty($conf->global->CLICKTODIAL_URL)) $urlmask='ErrorClickToDialModuleNotConfigured'; - else $urlmask=$conf->global->CLICKTODIAL_URL; + // Define urlmask + $urlmask='ErrorClickToDialModuleNotConfigured'; + if (! empty($conf->global->CLICKTODIAL_URL)) $urlmask=$conf->global->CLICKTODIAL_URL; + if (! empty($user->clicktodial_url)) $urlmask=$user->clicktodial_url; + $clicktodial_poste=(! empty($user->clicktodial_poste)?urlencode($user->clicktodial_poste):''); $clicktodial_login=(! empty($user->clicktodial_login)?urlencode($user->clicktodial_login):''); $clicktodial_password=(! empty($user->clicktodial_password)?urlencode($user->clicktodial_password):''); @@ -1224,7 +1227,7 @@ function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" $type='AC_TEL'; $link=''; if ($addlink == 'AC_FAX') $type='AC_FAX'; if (! empty($conf->global->AGENDA_ADDACTIONFORPHONE)) $link=''.img_object($langs->trans("AddAction"),"calendar").''; - $newphone='
    '.$newphone.'  '.$link.'
    '; + if ($link) $newphone='
    '.$newphone.'  '.$link.'
    '; } } diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index db609d76ad1..5c2a86122ea 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -208,3 +208,5 @@ ALTER TABLE llx_user ADD COLUMN town varchar(50); ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0; ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0; + +ALTER TABLE llx_user_clicktodial ADD COLUMN url varchar(255); diff --git a/htdocs/install/mysql/tables/llx_user_clicktodial.sql b/htdocs/install/mysql/tables/llx_user_clicktodial.sql index da97b33057b..bdaf90e8ae9 100644 --- a/htdocs/install/mysql/tables/llx_user_clicktodial.sql +++ b/htdocs/install/mysql/tables/llx_user_clicktodial.sql @@ -22,6 +22,7 @@ create table llx_user_clicktodial ( fk_user integer PRIMARY KEY, + url varchar(255), login varchar(32), pass varchar(64), poste varchar(20) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fef12f037fa..ff28b59e083 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -361,7 +361,12 @@ LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
    To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
    1 : local tax apply on products and services without vat (vat is not applied on local tax)
    2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)
    3 : local tax apply on products without vat (vat is not applied on local tax)
    4 : local tax apply on products before vat (vat is calculated on amount + localtax)
    5 : local tax apply on services without vat (vat is not applied on local tax)
    6 : local tax apply on services before vat (vat is calculated on amount + localtax) SMS=SMS -LinkToTestClickToDial=Link to test the ClickToDial +LinkToTestClickToDial=Enter a phone number to call to show a link to test the ClickToDial url for user %s +RefreshPhoneLink=Refresh link +LinkToTest=Clickable link generated for user %s (click phone number to test) +KeepEmptyToUseDefault=Keep empty to use default value +DefaultLink=Default link +ValueOverwrittenByUserSetup=Warning, this value may be overwritten by user specific setup (each user can set his own clicktodial url) # Modules Module0Name=Users & groups diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 6ffd8fba44a..8b56650b43b 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -360,7 +360,12 @@ WarningUsingFPDF=Attention: Votre fichier conf.php contient la directive LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:
    1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)
    2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)
    3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)
    4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)
    5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)
    6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale) SuhosinSessionEncrypt=Stockage des sessions encryptés par Suhosin SMS=SMS -LinkToTestClickToDial=Lien pour tester le ClickToDial +LinkToTestClickToDial=Entrez un numéro de téléphone à appeler pour tester le lien d'appel ClickToDial pour l'utilisateur %s +RefreshPhoneLink=Rafraichir lien +LinkToTest=Lien clicable généré pour l'utilisateur %s (cliquer le numéro pour tester) +KeepEmptyToUseDefault=Laisser ce champ vide pour utiliser la valeure par défaut +DefaultLink=Lien par défaut +ValueOverwrittenByUserSetup=Attention, cette valeur peut être écrasée par une valeur spécifique à la configuration de l'utilisateur (chaque utilisateur pouvant avoir sa propre url clicktodial) # Modules= undefined Module0Name= Utilisateurs & groupes diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index de4876bd275..a61289e7d09 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -81,6 +81,7 @@ class User extends CommonObject var $phenix_pass; var $phenix_pass_crypted; + var $clicktodial_url; var $clicktodial_login; var $clicktodial_password; var $clicktodial_poste; @@ -1549,7 +1550,7 @@ class User extends CommonObject */ function fetch_clicktodial() { - $sql = "SELECT login, pass, poste "; + $sql = "SELECT url, login, pass, poste "; $sql.= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u"; $sql.= " WHERE u.fk_user = ".$this->id; @@ -1560,6 +1561,7 @@ class User extends CommonObject { $obj = $this->db->fetch_object($resql); + $this->clicktodial_url = $obj->url; $this->clicktodial_login = $obj->login; $this->clicktodial_password = $obj->pass; $this->clicktodial_poste = $obj->poste; @@ -1589,26 +1591,28 @@ class User extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_clicktodial"; $sql .= " WHERE fk_user = ".$this->id; + dol_syslog(get_class($this).'::update_clicktodial sql='.$sql); $result = $this->db->query($sql); $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_clicktodial"; - $sql .= " (fk_user,login,pass,poste)"; + $sql .= " (fk_user,url,login,pass,poste)"; $sql .= " VALUES (".$this->id; - $sql .= ", '". $this->clicktodial_login ."'"; - $sql .= ", '". $this->clicktodial_password ."'"; - $sql .= ", '". $this->clicktodial_poste."')"; + $sql .= ", '". $this->db->escape($this->clicktodial_url) ."'"; + $sql .= ", '". $this->db->escape($this->clicktodial_login) ."'"; + $sql .= ", '". $this->db->escape($this->clicktodial_password) ."'"; + $sql .= ", '". $this->db->escape($this->clicktodial_poste) ."')"; + dol_syslog(get_class($this).'::update_clicktodial sql='.$sql); $result = $this->db->query($sql); - if ($result) { $this->db->commit(); - return 0; + return 1; } else { $this->db->rollback(); - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index bd39655b730..48f02ca5603 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -51,11 +51,13 @@ if ($action == 'update' && ! $_POST['cancel']) $edituser = new User($db); $edituser->fetch($id); - $edituser->clicktodial_login = $_POST["login"]; - $edituser->clicktodial_password = $_POST["password"]; - $edituser->clicktodial_poste = $_POST["poste"]; + $edituser->clicktodial_url = GETPOST("url"); + $edituser->clicktodial_login = GETPOST("login"); + $edituser->clicktodial_password = GETPOST("password"); + $edituser->clicktodial_poste = GETPOST("poste"); $result=$edituser->update_clicktodial(); + if ($result < 0) setEventMessage($edituser->error,'errors'); } @@ -110,7 +112,7 @@ if ($id > 0) print "\n"; print "
    \n"; - + // Edit mode if ($action == 'edit') { print '
    '; @@ -122,13 +124,17 @@ if ($id > 0) { print 'ClickToDial URL'; print ''; - if (empty($conf->global->CLICKTODIAL_URL)) + print ''; + if (empty($conf->global->CLICKTODIAL_URL) && empty($fuser->clicktodial_url)) { $langs->load("errors"); print ''.$langs->trans("ErrorModuleSetupNotComplete").''; } - else print $form->textwithpicto($conf->global->CLICKTODIAL_URL,$langs->trans("ClickToDialUrlDesc")); - print ''; + else + { + print '     '.$form->textwithpicto($langs->trans("KeepEmptyToUseDefault").': '.$conf->global->CLICKTODIAL_URL,$langs->trans("ClickToDialUrlDesc")); + } + print ''; print ''; } @@ -147,14 +153,16 @@ if ($id > 0) print ''; print "\n"; - print ''; - print '     '; - print ''; - print ''; + print ''; - print '
    '; + print '
    '; + print '     '; + print ''; + print '
    '; + + print ''; } - else + else // View mode { print ''; @@ -163,12 +171,17 @@ if ($id > 0) { print "".''; print ''; print ''; } From d752a41f05d5415e12630368a5a7eaffd5ea5c51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 16:51:49 +0200 Subject: [PATCH 34/37] Add helper --- htdocs/admin/clicktodial.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 0ddd7f1abdc..726bd912964 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -84,11 +84,11 @@ print '
    '; print $langs->trans("ClickToDialUrlDesc").'
    '; print $langs->trans("Example").':
    http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; -if (! empty($user->clicktodial_url)) -{ +//if (! empty($user->clicktodial_url)) +//{ print '
    '; print info_admin($langs->trans("ValueOverwrittenByUserSetup")); -} +//} print ''; @@ -96,7 +96,7 @@ print '
    ClickToDial URL'; - if (empty($conf->global->CLICKTODIAL_URL)) + $url=$conf->global->CLICKTODIAL_URL; + if (! empty($fuser->clicktodial_url)) $url=$fuser->clicktodial_url; + if (empty($url)) { $langs->load("errors"); print ''.$langs->trans("ErrorModuleSetupNotComplete").''; } - else print $form->textwithpicto($conf->global->CLICKTODIAL_URL,$langs->trans("ClickToDialUrlDesc")); + else + { + print $form->textwithpicto((empty($fuser->clicktodial_url)?$langs->trans("DefaultLink").': ':'').$url,$langs->trans("ClickToDialUrlDesc")); + } print '
    '; print '

    '; -print ''; +print '

    '; if (! empty($conf->global->CLICKTODIAL_URL)) From e352e4a56f65885a7d3ed589090079b15b63f3e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2013 19:54:56 +0200 Subject: [PATCH 35/37] New: Work on new menu management. --- htdocs/core/class/menubase.class.php | 13 ++++++--- htdocs/core/getmenu_jmobile.php | 2 +- htdocs/core/menus/standard/auguria_menu.php | 32 ++++++++++++++------- htdocs/core/menus/standard/eldy_menu.php | 24 +++++++++------- 4 files changed, 46 insertions(+), 25 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 7ae947ee518..5ebccdeb1bd 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -512,6 +512,7 @@ class Menubase if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)"; if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)"; $sql.= " ORDER BY m.position, m.rowid"; + //print $sql; //$tmp1=dol_microtime_float(); //print '>>> 1 0
    '; @@ -533,17 +534,21 @@ class Menubase $perms = true; if ($menu['perms']) { - $perms = verifCond($menu['perms']); - //print "verifCond rowid=".$menu['rowid']." ".$menu['perms'].":".$perms."
    \n"; + $tmpcond=$menu['perms']; + if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z]+/','1==1',$tmpcond); // Force part of condition to true + $perms = verifCond($tmpcond); + //print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."
    \n"; } // Define $enabled $enabled = true; if ($menu['enabled']) { - $enabled = verifCond($menu['enabled']); + $tmpcond=$menu['enabled']; + if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z]+/','1==1',$tmpcond); // Force part of condition to true + $enabled = verifCond($tmpcond); if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && preg_match('/^\$leftmenu/',$menu['enabled'])) $enabled=1; - //print "verifCond rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."
    \n"; + //print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$enabled."
    \n"; } // Define $title diff --git a/htdocs/core/getmenu_jmobile.php b/htdocs/core/getmenu_jmobile.php index 4075bbc77b6..78c46c60fbb 100644 --- a/htdocs/core/getmenu_jmobile.php +++ b/htdocs/core/getmenu_jmobile.php @@ -88,7 +88,7 @@ if (! class_exists('MenuManager')) } } $menumanager = new MenuManager($db, empty($user->societe_id)?0:1); -$menumanager->loadMenu(); +$menumanager->loadMenu('all','all'); $menumanager->showmenu('jmobile'); diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index e33d08403ac..343edaf5201 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -51,13 +51,15 @@ class MenuManager $this->db=$db; } - + /** * Load this->tabMenu * + * @param string $forcemainmenu To force mainmenu to load + * @param string $forceleftmenu To force leftmenu to load * @return void */ - function loadMenu() + function loadMenu($forcemainmenu='',$forceleftmenu='') { global $conf, $user, $langs; @@ -78,6 +80,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; } + if (! empty($forcemainmenu)) $mainmenu=$forcemainmenu; if (isset($_GET["leftmenu"])) { @@ -98,6 +101,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; } + if (! empty($forceleftmenu)) $leftmenu=$forceleftmenu; require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; $tabMenu=array(); @@ -167,16 +171,16 @@ class MenuManager } $res='ErrorBadParameterForMode'; - + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - + if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); if ($mode == 'jmobile') { $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); - + foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { print '
      '; @@ -184,13 +188,15 @@ class MenuManager if ($val['enabled'] == 1) { $relurl=dol_buildpath($val['url'],1); - + print ''.$val['titre'].''."\n"; // Search submenu fot this entry $tmpmainmenu=$val['mainmenu']; $tmpleftmenu='all'; $submenu=new Menu(); + //var_dump($tmpmainmenu.' - '.$tmpleftmenu); $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); + //var_dump($submenu->liste); $nexturl=dol_buildpath($submenu->liste[0]['url'],1); $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); @@ -205,8 +211,14 @@ class MenuManager foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { $relurl2=dol_buildpath($val2['url'],1); - //var_dump($val2); - print ''.$val2['titre'].''."\n"; + $canonurl2=preg_replace('/\?.*$/','',$val2['url']); + //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']); + if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php'))) $relurl2=''; + print ''; + if ($relurl2) print ''; + print $val2['titre']; + if ($relurl2) print ''; + print ''."\n"; } //var_dump($submenu); print '
    '; @@ -219,9 +231,9 @@ class MenuManager print ''."\n"; } } - + unset($this->menu); - + return $res; } } diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 8b381ed7038..18d64839fdc 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -49,14 +49,16 @@ class MenuManager $this->type_user=$type_user; $this->db=$db; } - - + + /** * Load this->tabMenu - * + * + * @param string $forcemainmenu To force mainmenu to load + * @param string $forceleftmenu To force leftmenu to load * @return void */ - function loadMenu() + function loadMenu($forcemainmenu='',$forceleftmenu='') { // On sauve en session le menu principal choisi if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; @@ -75,6 +77,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; } + if (! empty($forcemainmenu)) $mainmenu=$forcemainmenu; if (isset($_GET["leftmenu"])) { @@ -95,6 +98,7 @@ class MenuManager // On va le chercher en session si non defini par le lien $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; } + if (! empty($forceleftmenu)) $leftmenu=$forceleftmenu; require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; $tabMenu=array(); @@ -123,13 +127,13 @@ class MenuManager } $res='ErrorBadParameterForMode'; - + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - + if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu); - if ($mode == 'jmobile') + if ($mode == 'jmobile') { $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); @@ -166,18 +170,18 @@ class MenuManager } //var_dump($submenu); print ''; - } + } if ($val['enabled'] == 2) { print ''.$val['titre'].''; - } + } print ''; print ''."\n"; } } unset($this->menu); - + //print 'xx'.$mode; return $res; } From df08d838d7eeb6c1ad1777e332ac25bda4df1066 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Apr 2013 14:49:33 +0200 Subject: [PATCH 36/37] More robust phpunit tests --- htdocs/user/class/user.class.php | 6 ++- test/phpunit/UserTest.php | 63 ++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a61289e7d09..607e0563e7d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1969,6 +1969,8 @@ class User extends CommonObject $this->admin=0; $this->login='dolibspec'; $this->pass='dolibspec'; + //$this->pass_indatabase='dolibspec'; Set after a fetch + //$this->pass_indatabase_crypted='e80ca5a88c892b0aaaf7e154853bccab'; Set after a fetch $this->datec=time(); $this->datem=time(); $this->webcal_login='dolibspec'; @@ -1977,7 +1979,9 @@ class User extends CommonObject $this->datepreviouslogin=time(); $this->statut=1; - $this->societe_id = 1; + //$this->societe_id = 1; For external users + //$this->contact_id = 1; For external users + $this->entity = 1; } /** diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index abb7ab80cc5..088115a64ec 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -176,12 +176,19 @@ class UserTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; - $localobject->note='New note after update'; - $result=$localobject->update($user); + $this->changeProperties($localobject); + $result=$localobject->update($user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); - return $localobject; + + // Test everything are still same than specimen + $newlocalobject=new User($this->savdb); + $newlocalobject->initAsSpecimen(); + $this->changeProperties($newlocalobject); + $this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('id','ref','pass_indatabase','pass_indatabase_crypted','date_creation','datelastlogin','datepreviouslogin')), array()); // Actual, Expected + + return $localobject; } /** @@ -204,6 +211,7 @@ class UserTest extends PHPUnit_Framework_TestCase print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); + return $localobject; } @@ -260,5 +268,54 @@ class UserTest extends PHPUnit_Framework_TestCase return $result; } + + /** + * Edit an object to test updates + * + * @param mixed &$localobject Object Facture + * @return void + */ + public function changeProperties(&$localobject) + { + $localobject->note='New note after update'; + } + + /** + * Compare all public properties values of 2 objects + * + * @param Object $oA Object operand 1 + * @param Object $oB Object operand 2 + * @param boolean $ignoretype False will not report diff if type of value differs + * @param array $fieldstoignorearray Array of fields to ignore in diff + * @return array Array with differences + */ + public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id')) + { + $retAr=array(); + + if (get_class($oA) !== get_class($oB)) + { + $retAr[]="Supplied objects are not of same class."; + } + else + { + $oVarsA=get_object_vars($oA); + $oVarsB=get_object_vars($oB); + $aKeys=array_keys($oVarsA); + foreach($aKeys as $sKey) + { + if (in_array($sKey,$fieldstoignorearray)) continue; + if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) + { + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + } + if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey]) + { + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + } + } + } + return $retAr; + } } ?> \ No newline at end of file From bbe68e341ca73462c8a4f9c6783fc17bf1afd447 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Apr 2013 15:28:53 +0200 Subject: [PATCH 37/37] Fix: dol_hide_topmenu and dol_hide_leftmenu not lost after logout --- htdocs/user/logout.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 5830d809c0b..f5523c791f2 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -33,12 +33,12 @@ if (! defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) define('EVEN_IF_ONLY_LOGIN_ALLOWED require_once '../main.inc.php'; // This can happen only with a bookmark or forged url call. -if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser' - || $_SESSION["dol_authmode"] == 'http')) +if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser' || $_SESSION["dol_authmode"] == 'http')) { die("Disconnection does not work when connection was made in mode ".$_SESSION["dol_authmode"]); } + // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); @@ -53,13 +53,16 @@ $urlfrom=empty($_SESSION["urlfrom"])?'':$_SESSION["urlfrom"]; // TODO external module if (! empty($conf->phenix->enabled) && ! empty($conf->phenix->cookie)) { - // Destroy cookie setcookie($conf->phenix->cookie, '', 1, "/"); } -// Destroy object of session -unset($_SESSION['dol_login']); -unset($_SESSION['dol_entity']); +// Define url to go +$url=DOL_URL_ROOT."/index.php"; // By default go to login page +if ($urlfrom) $url=DOL_URL_ROOT.$urlfrom; +if (! empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url=$conf->global->MAIN_LOGOUT_GOTO_URL; + +if (! empty($_SESSION['dol_hide_topmenu'])) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_topmenu=1'; +if (! empty($_SESSION['dol_hide_leftmenu'])) $url.=(preg_match('/\?/',$url)?'&':'?').'dol_hide_leftmenu=1'; // Destroy session $prefix=dol_getprefix(); @@ -70,10 +73,9 @@ session_name($sessionname); session_destroy(); dol_syslog("End of session ".$sessionname); -// Define url to go -$url=DOL_URL_ROOT."/index.php"; // By default go to login page -if ($urlfrom) $url=DOL_URL_ROOT.$urlfrom; -if (! empty($conf->global->MAIN_LOGOUT_GOTO_URL)) $url=$conf->global->MAIN_LOGOUT_GOTO_URL; +// TODO Not sure this is required +unset($_SESSION['dol_login']); +unset($_SESSION['dol_entity']); //print 'url='.$url;exit; header("Location: ".$url);