diff --git a/.travis.yml b/.travis.yml index d660f89e79d..b4621de8a81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -342,6 +342,9 @@ script: php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log + php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log + php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log + php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log cd - set +e echo diff --git a/build/debian/source/include-binaries b/build/debian/source/include-binaries new file mode 100644 index 00000000000..401eae93712 --- /dev/null +++ b/build/debian/source/include-binaries @@ -0,0 +1 @@ +htdocs/install/doctemplates/websites/website_template-corporate.zip \ No newline at end of file diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index 589e2a3f55c..a28fc430caa 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -30,7 +30,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "7.0.0", "6.0.5", "5.0.7" ); +return ( "9.0.0", "8.0.3", "7.0.4", "6.0.8", "5.0.7" ); } sub script_dolibarr_release @@ -263,15 +263,16 @@ if ($upgrade) { local @params = ( [ "action", "upgrade" ], [ "versionfrom", $upgrade->{'version'} ], [ "versionto", $ver ], + [ "installlock", "444" ], ); local $p = $ver >= 3.8 ? "step5" : "etape5"; local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); return (-1, "Dolibarr wizard failed : $err") if ($err); - # Remove the installation directory. - local $dinstall = "$opts->{'dir'}/install"; - $dinstall =~ s/\/$//; - $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); + # Remove the installation directory. (deprecated) + # local $dinstall = "$opts->{'dir'}/install"; + # $dinstall =~ s/\/$//; + # $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); } else { @@ -306,15 +307,18 @@ else { [ "login", "admin" ], [ "pass", $dompass ], [ "pass_verif", $dompass ], + [ "installlock", "444" ], ); local $p = $ver >= 3.8 ? "step5" : "etape5"; local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); return (-1, "Dolibarr wizard failed : $err") if ($err); - # Remove the installation directory and protect config file. - local $dinstall = "$opts->{'dir'}/install"; - $dinstall =~ s/\/$//; - $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); + # Remove the installation directory (deprecated) + # local $dinstall = "$opts->{'dir'}/install"; + # $dinstall =~ s/\/$//; + # $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); + + # Protect config file &set_permissions_as_domain_user($d, 0644, $cfile); &set_permissions_as_domain_user($d, 0755, $cfiledir); } @@ -386,6 +390,8 @@ sub script_dolibarr_check_latest { local ($ver) = @_; local @vers = &osdn_package_versions("dolibarr", + $ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" : + $ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" : diff --git a/dev/resources/dbmodel/dolibarr.uml b/dev/resources/dbmodel/dolibarr.uml deleted file mode 100644 index 57078d6668b..00000000000 --- a/dev/resources/dbmodel/dolibarr.uml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/dev/resources/dbmodel/dolibarr.umldi b/dev/resources/dbmodel/dolibarr.umldi deleted file mode 100644 index ff97a2a25b1..00000000000 --- a/dev/resources/dbmodel/dolibarr.umldi +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/resources/dbmodel/dolibarr_schema.mwb b/dev/resources/dbmodel/dolibarr_schema.mwb index aec0f2d2299..80d1d612d65 100644 Binary files a/dev/resources/dbmodel/dolibarr_schema.mwb and b/dev/resources/dbmodel/dolibarr_schema.mwb differ diff --git a/doc/install/README b/doc/install/README index 83bc6484cea..0c7341b196c 100644 --- a/doc/install/README +++ b/doc/install/README @@ -7,12 +7,12 @@ Download -------------------------------- * Dolibarr ERP/CRM can be downloaded at sourceforge: -http://sourceforge.net/projects/dolibarr/files -or from Dolibarr official web site: -http://www.dolibarr.org + https://sourceforge.net/projects/dolibarr/files + or from Dolibarr official web site: + https://www.dolibarr.org * Most external modules are only available on DoliStore: -http://www.dolistore.org + https://www.dolistore.com -------------------------------- @@ -22,4 +22,4 @@ Install * For a Quick guide, take a look at README file into root directory. * More complete documentations are also available on line on the Dolibarr Wiki: -http://wiki.dolibarr.org + https://wiki.dolibarr.org diff --git a/doc/install/README-DE b/doc/install/README-DE new file mode 100644 index 00000000000..c7ece3891f3 --- /dev/null +++ b/doc/install/README-DE @@ -0,0 +1,33 @@ +README (deutsch / german / allemand) +-------------------------------- + + +-------------------------------- +Download / Herunterladen +-------------------------------- + +* Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website + https://www.dolibarr.org/downloads + oder direkt von Sourceforge + https://sourceforge.net/projects/dolibarr/files/ + herunterladen. + + + +* Die meisten externen Module/Themens sind über den DoliStore verfügbar: + https://www.dolistore.com/de/ + + +-------------------------------- +Installation +-------------------------------- + +* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis. + +* Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden: + https://wiki.dolibarr.org/index.php/Hauptseite + +* eine Deutsche Community bietet der Dolibarr e.V. unter + https://www.dolibarr.de/ + + diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 347c29fc30d..b77759b98a3 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1286,8 +1286,11 @@ else $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_MEMBER); - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; + $arrayselected = array(); + if (is_array($cats)) { + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } } print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print ""; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 39d31986511..cee9ce36edd 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -59,6 +59,9 @@ class Adherent extends CommonObject public $mesgs; + /** + * @var string login of member + */ public $login; //! Clear password in memory @@ -68,29 +71,70 @@ class Adherent extends CommonObject //! Encrypted password in database (always defined) public $pass_indatabase_crypted; + /** + * @var string company name + * @deprecated + */ public $societe; /** - * @var Societe $company {@type Societe} + * @var string company name */ public $company; + /** + * @var int Thirdparty ID + */ + public $fk_soc; + /** * @var string Address */ public $address; - public $zip; + /** + * @var string zipcode + */ + public $zip; + + /** + * @var string town + */ public $town; - public $state_id; // Id of department - public $state_code; // Code of department - public $state; // Label of department + /** + * @var int Id of state + */ + public $state_id; + /** + * @var string Code of state + */ + public $state_code; + + /** + * @var string Label of state + */ + public $state; + + /** + * @var string email + */ public $email; - public $skype; - public $twitter; + /** + * @var string skype account + */ + public $skype; + + /** + * @var string twitter account + */ + public $twitter; + + /** + * @var string facebook account + */ public $facebook; /** @@ -120,8 +164,12 @@ class Adherent extends CommonObject public $morphy; public $public; - public $statut; // -1:brouillon, 0:resilie, >=1:valide,paye - public $photo; + + // -1:brouillon, 0:resilie, >=1:valide,paye + // def in common object + //public $statut; + + public $photo; public $datec; public $datem; @@ -129,21 +177,20 @@ class Adherent extends CommonObject public $birth; - public $note_public; - public $note_private; + /** + * @var int id type member + */ + public $typeid; - public $typeid; // Id type adherent - public $type; // Libelle type adherent + /** + * @var string label type member + */ + public $type; public $need_subscription; public $user_id; public $user_login; - /** - * @var int Thirdparty ID - */ - public $fk_soc; - public $datefin; // From member table // Fields loaded by fetch_subscriptions() @@ -155,7 +202,10 @@ class Adherent extends CommonObject public $last_subscription_amount; public $subscriptions=array(); - public $oldcopy; // To contains a clone of this when we need to save old properties of object + /** + * @var Adherent To contains a clone of this when we need to save old properties of object + */ + public $oldcopy; /** * @var int Entity @@ -593,11 +643,11 @@ class Adherent extends CommonObject $luser->societe_id=$this->societe; $luser->birth=$this->birth; - $luser->address=$this->address; - $luser->zip=$this->zip; - $luser->town=$this->town; - $luser->country_id=$this->country_id; - $luser->state_id=$this->state_id; + $luser->address=$this->address; + $luser->zip=$this->zip; + $luser->town=$this->town; + $luser->country_id=$this->country_id; + $luser->state_id=$this->state_id; $luser->email=$this->email; $luser->skype=$this->skype; diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 7b8f453c94c..29f1f94e683 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -337,11 +337,14 @@ class Subscription extends CommonObject /** * Return clicable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $notooltip 1=Disable tooltip - * @return string Chaine avec URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $notooltip 1=Disable tooltip + * @param string $option Page for link ('', 'nolink', ...) + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $notooltip=0) + function getNomUrl($withpicto=0, $notooltip=0, $option='', $morecss='', $save_lastsearch_value=-1) { global $langs; @@ -350,8 +353,18 @@ class Subscription extends CommonObject $langs->load("members"); $label=$langs->trans("ShowSubscription").': '.$this->ref; - $linkstart = ''; - $linkend=''; + $url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkstart = ''; + $linkend = ''; $picto='payment'; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 39d0069ac7c..8eb7109d9ed 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -79,8 +79,9 @@ $pagenext = $page + 1; if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); } if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); } -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Adherent($db); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('memberlist')); $extrafields = new ExtraFields($db); @@ -348,8 +349,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( -// 'presend'=>$langs->trans("SendByMail"), -// 'builddoc'=>$langs->trans("PDFMerge"), + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); @@ -603,6 +604,7 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="c print "\n"; $i = 0; +$totalarray=array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -631,6 +633,7 @@ while ($i < min($num, $limit)) if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { print ''.$obj->rowid.''; + if (! $i) $totalarray['nbfield']++; } // Ref @@ -639,6 +642,7 @@ while ($i < min($num, $limit)) print ""; print $memberstatic->getNomUrl(-1, 0, 'card', 'ref'); print "\n"; + if (! $i) $totalarray['nbfield']++; } // Civility if (! empty($arrayfields['d.civility']['checked'])) @@ -646,6 +650,7 @@ while ($i < min($num, $limit)) print ""; print $obj->civility; print "\n"; + if (! $i) $totalarray['nbfield']++; } // Firstname if (! empty($arrayfields['d.firstname']['checked'])) @@ -653,6 +658,7 @@ while ($i < min($num, $limit)) print ""; print $obj->firstname; print "\n"; + if (! $i) $totalarray['nbfield']++; } // Lastname if (! empty($arrayfields['d.lastname']['checked'])) @@ -660,6 +666,7 @@ while ($i < min($num, $limit)) print ""; print $obj->lastname; print "\n"; + if (! $i) $totalarray['nbfield']++; } // Company if (! empty($arrayfields['d.company']['checked'])) @@ -672,11 +679,13 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['d.login']['checked'])) { print "".$obj->login."\n"; + if (! $i) $totalarray['nbfield']++; } // Moral/Physique if (! empty($arrayfields['d.morphy']['checked'])) { print "".$memberstatic->getmorphylib($obj->morphy)."\n"; + if (! $i) $totalarray['nbfield']++; } // Type label if (! empty($arrayfields['t.libelle']['checked'])) @@ -686,6 +695,7 @@ while ($i < min($num, $limit)) print ''; print $membertypestatic->getNomUrl(1,32); print ''; + if (! $i) $totalarray['nbfield']++; } // Address if (! empty($arrayfields['d.address']['checked'])) @@ -693,6 +703,7 @@ while ($i < min($num, $limit)) print ''; print $obj->address; print ''; + if (! $i) $totalarray['nbfield']++; } // Zip if (! empty($arrayfields['d.zip']['checked'])) @@ -828,6 +839,36 @@ while ($i < min($num, $limit)) $i++; } +// Show total line +if (isset($totalarray['pos'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; + } + else print ''; + } + } + print ''; +} + +// If no record found +if ($num == 0) +{ + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; +} + $db->free($resql); $parameters=array('sql' => $sql); diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 94950f02b05..e458bf093f6 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -191,7 +191,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; print "\n"; print ''; @@ -290,7 +290,7 @@ if ($rowid && $action != 'edit') print ''; print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'rowid', $linkback, 1); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 4ef43e8f316..4b3e24d019e 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -28,12 +28,18 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -$langs->load("members"); +$langs->load(array("members","companies")); -$filter=$_GET["filter"]; -$statut=isset($_GET["statut"])?$_GET["statut"]:1; +$action=GETPOST('action','aZ09'); +$massaction=GETPOST('massaction','alpha'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + +$filter=GETPOST("filter","alpha"); +$statut=(GETPOSTISSET("statut")?GETPOST("statut","alpha"):1); $search_ref=GETPOST('search_ref','alpha'); $search_lastname=GETPOST('search_lastname','alpha'); +$search_firstname=GETPOST('search_firstname','alpha'); $search_login=GETPOST('search_login','alpha'); $search_note=GETPOST('search_note','alpha'); $search_account=GETPOST('search_account','int'); @@ -67,6 +73,20 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, $fieldstosearchall = array( ); $arrayfields=array( + 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), + 'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1), + 'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1), + 't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1), + 'd.bank'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'enabled'=>(! empty($conf->banque->enabled))), + /*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0), + 'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/ + 'd.datedebut'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100), + 'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101), + 'd.amount'=>array('label'=>$langs->trans("Amount"), 'checked'=>1, 'position'=>102), + 'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), +// 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000) ); // Security check @@ -74,7 +94,7 @@ $result=restrictedArea($user,'adherent','','','cotisation'); /* - * Actions + * Actions */ if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } @@ -111,15 +131,16 @@ if (empty($reshook)) */ $form=new Form($db); +$subscription=new Subscription($db); +$adherent=new Adherent($db); +$accountstatic=new Account($db); -llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); - +$now=dol_now(); // List of subscriptions $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,"; $sql.= " c.rowid as crowid, c.subscription,"; -$sql.= " c.dateadh,"; -$sql.= " c.datef,"; +$sql.= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,"; $sql.= " c.fk_bank as bank, c.note,"; $sql.= " b.fk_account"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; @@ -136,253 +157,444 @@ if ($search_ref) if (is_numeric($search_ref)) $sql.= " AND (c.rowid = ".$db->escape($search_ref).")"; else $sql.=" AND 1 = 2"; // Always wrong } -if ($search_lastname) $sql.= natural_search(array('d.firstname','d.lastname','d.societe'), $search_lastname); -if ($search_login) $sql.= natural_search('c.subscription', $search_login); +if ($search_lastname) $sql.= natural_search(array('d.lastname','d.societe'), $search_lastname); +if ($search_firstname) $sql.= natural_search(array('d.firstname'), $search_firstname); +if ($search_login) $sql.= natural_search('d.login', $search_login); if ($search_note) $sql.= natural_search('c.note', $search_note); -if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account; +if ($search_account > 0) $sql.= " AND b.fk_account = ".urldecode($search_account); if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1); + +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= $db->order($sortfield,$sortorder); +// Count total nb of records with no order and no limits $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); + $resql = $db->query($sql); + if ($resql) $nbtotalofrecords = $db->num_rows($resql); + else dol_print_error($db); if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 { $page = 0; $offset = 0; } } - +// Add limit $sql.= $db->plimit($limit+1, $offset); $result = $db->query($sql); -if ($result) +if (! $result) { - $num = $db->num_rows($result); + dol_print_error($db); + exit; +} - $arrayofselected=is_array($toselect)?$toselect:array(); +$num = $db->num_rows($result); - $i = 0; +$arrayofselected=is_array($toselect)?$toselect:array(); - $title=$langs->trans("ListOfSubscriptions"); - if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')'; +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/adherents/subscription/card.php?id='.$id); + exit; +} - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($statut != '') $param.="&statut=".$statut; - if ($date_select) $param.="&date_select=".$date_select; - if ($search_lastname) $param.="&search_lastname=".$search_lastname; - if ($search_login) $param.="&search_login=".$search_login; - if ($search_acount) $param.="&search_account=".$search_account; - if ($search_amount) $param.="&search_amount=".$search_amount; - if ($optioncss != '') $param.='&optioncss='.$optioncss; +llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); - // List of mass actions available - $arrayofmassactions = array( - //'presend'=>$langs->trans("SendByMail"), - //'builddoc'=>$langs->trans("PDFMerge"), - ); - if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); - if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('', $arrayofmassactions); +$i = 0; - $newcardbutton=''; - if ($user->rights->adherent->cotisation->creer) - { - $newcardbutton=''.$langs->trans('NewSubscription').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } +$title=$langs->trans("ListOfSubscriptions"); +if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')'; - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); +if ($statut != '') $param.="&statut=".urlencode($statut); +if ($date_select) $param.="&date_select=".urlencode($date_select); +if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname); +if ($search_login) $param.="&search_login=".urlencode($search_login); +if ($search_acount) $param.="&search_account=".urlencode($search_account); +if ($search_amount) $param.="&search_amount=".urlencode($search_amount); +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); +// List of mass actions available +$arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), +); +//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); - $topicmail="Information"; - $modelmail="subscription"; - $objecttmp=new Subscription($db); - $trackid='sub'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; +$newcardbutton=''; +if ($user->rights->adherent->cotisation->creer) +{ + $newcardbutton=''.$langs->trans('NewSubscription').''; + $newcardbutton.= ''; + $newcardbutton.= ''; +} - if ($sall) - { - print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; - } +print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; - $moreforfilter = ''; +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); +$topicmail="Information"; +$modelmail="subscription"; +$objecttmp=new Subscription($db); +$trackid='sub'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; - print '
'; - print '
'."\n"; +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; +} - // Line for filters fields - print ''; +$moreforfilter = ''; +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + +print '
'; +print '
'."\n"; + + +// Line for filters fields +print ''; + +// Line numbering +if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) +{ + print ''; +} + +// Ref +if (! empty($arrayfields['d.ref']['checked'])) +{ print ''; +} +if (! empty($arrayfields['d.lastname']['checked'])) +{ print ''; + print ''; +} +if (! empty($arrayfields['d.firstname']['checked'])) +{ + print ''; +} + +if (! empty($arrayfields['d.login']['checked'])) +{ print ''; +} - print ''; +if (! empty($arrayfields['t.libelle']['checked'])) +{ + print ''; +} - if (! empty($conf->banque->enabled)) - { - print ''; - } +if (! empty($arrayfields['d.bank']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['d.date_debut']['checked'])) +{ print ''; +} +if (! empty($arrayfields['d.date_fin']['checked'])) +{ print ''; +} +if (! empty($arrayfields['d.amount']['checked'])) +{ print ''; - - // Action column - print ''; - - print "\n"; - - - print ''; - print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) - { - print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder); - } - print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder); - //print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); - print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - - - // Static objects - $subscription=new Subscription($db); - $adherent=new Adherent($db); - $accountstatic=new Account($db); - - $total=0; - while ($i < min($num, $limit)) - { - $obj = $db->fetch_object($result); - $total+=$obj->subscription; - - $subscription->ref=$obj->crowid; - $subscription->id=$obj->crowid; - - $adherent->lastname=$obj->lastname; - $adherent->firstname=$obj->firstname; - $adherent->ref=$obj->rowid; - $adherent->id=$obj->rowid; - $adherent->statut=$obj->statut; - $adherent->login=$obj->login; - $adherent->photo=$obj->photo; - - - - print ''; - - // Ref - print ''; - - // Lastname - print ''; - - // Login - print ''; - - // Libelle - print ''; - - // Banque - if (! empty($conf->banque->enabled)) - { - if ($obj->fk_account > 0) - { - $accountstatic->id=$obj->fk_account; - $accountstatic->fetch($obj->fk_account); - //$accountstatic->label=$obj->label; - print ''; - } - else - { - print "\n"; - } - } - - // Date start - print '\n"; - - // Date end - print '\n"; - - // Price - print ''; - - print ''; - - print ""; - - $i++; - } - - // Total - - print ''; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - if (! empty($conf->banque->enabled)) - { - print ''; - } - print ''; - print ''; - print '\n"; - print ''; - print "\n"; - - print "
 '; print ''; - print ''; + print ''; print ''; - print ''; + print ''; + print ''; - print $form->select_comptes($search_account, 'search_account', 0, '', 1); - print ''; + print $form->select_comptes($search_account, 'search_account', 0, '', 1); + print '  '; print ''; print ''; - $searchpicto=$form->showFilterButtons(); - print $searchpicto; - print '
'.$subscription->getNomUrl(1).''.$adherent->getNomUrl(-1).''.$adherent->login.''; - print dol_trunc($obj->note,32); - print ''.$accountstatic->getNomUrl(1).'"; - print "'.dol_print_date($db->jdate($obj->dateadh),'day')."'.dol_print_date($db->jdate($obj->datef),'day')."'.price($obj->subscription).'
".$langs->trans("Total")."      '.price($total)."
"; - print ''; - print ''; } -else +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + +// Fields from hook +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Date creation +if (! empty($arrayfields['d.datec']['checked'])) { - dol_print_error($db); + print ''; + print ''; } +// Date modification +if (! empty($arrayfields['d.tms']['checked'])) +{ + print ''; + print ''; +} + +// Action column +print ''; +$searchpicto=$form->showFilterButtons(); +print $searchpicto; +print ''; + +print "\n"; + + +print ''; +if (! empty($arrayfields['d.ref']['checked'])) +{ + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder); +} +if (! empty($arrayfields['d.lastname']['checked'])) +{ + print_liste_field_titre("LastName",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); +} +if (! empty($arrayfields['d.firstname']['checked'])) +{ + print_liste_field_titre("FirstName",$_SERVER["PHP_SELF"],"d.firstname",$param,"","",$sortfield,$sortorder); +} +if (! empty($arrayfields['d.login']['checked'])) +{ + print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); +} +if (! empty($arrayfields['t.libelle']['checked'])) +{ + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder); +} +if (! empty($arrayfields['d.bank']['checked'])) +{ + print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder); +} +if (! empty($arrayfields['d.date_debut']['checked'])) +{ + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); +} +if (! empty($arrayfields['d.date_fin']['checked'])) +{ + print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder); +} +if (! empty($arrayfields['d.amount']['checked'])) +{ + print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder); +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + +// Hook fields +$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + + +$total=0; +$totalarray=array(); +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($result); + $total+=$obj->subscription; + + $subscription->ref=$obj->crowid; + $subscription->id=$obj->crowid; + + $adherent->lastname=$obj->lastname; + $adherent->firstname=$obj->firstname; + $adherent->ref=$obj->rowid; + $adherent->id=$obj->rowid; + $adherent->statut=$obj->statut; + $adherent->login=$obj->login; + $adherent->photo=$obj->photo; + + + print ''; + + // Ref + if (! empty($arrayfields['d.ref']['checked'])) + { + print ''.$subscription->getNomUrl(1).''; + if (! $i) $totalarray['nbfield']++; + } + + // Lastname + if (! empty($arrayfields['d.lastname']['checked'])) + { + $adherent->firstname = ''; + print ''.$adherent->getNomUrl(-1).''; + $adherent->firstname = $obj->firstname; + if (! $i) $totalarray['nbfield']++; + } + // Firstname + if (! empty($arrayfields['d.firstname']['checked'])) + { + print ''.$adherent->firstname.''; + if (! $i) $totalarray['nbfield']++; + } + + // Login + if (! empty($arrayfields['d.login']['checked'])) + { + print ''.$adherent->login.''; + if (! $i) $totalarray['nbfield']++; + } + + // Label + if (! empty($arrayfields['t.libelle']['checked'])) + { + print ''; + print dol_trunc($obj->note,128); + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Banque + if (! empty($arrayfields['d.bank']['checked'])) + { + print ""; + if ($obj->fk_account > 0) + { + $accountstatic->id=$obj->fk_account; + $accountstatic->fetch($obj->fk_account); + //$accountstatic->label=$obj->label; + print $accountstatic->getNomUrl(1); + } + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + + // Date start + if (! empty($arrayfields['d.date_start']['checked'])) + { + print ''.dol_print_date($db->jdate($obj->dateadh),'day')."\n"; + if (! $i) $totalarray['nbfield']++; + } + // Date end + if (! empty($arrayfields['d.date_end']['checked'])) + { + print ''.dol_print_date($db->jdate($obj->datef),'day')."\n"; + if (! $i) $totalarray['nbfield']++; + } + // Price + if (! empty($arrayfields['d.amount']['checked'])) + { + print ''.price($obj->subscription).''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='d.amount'; + $totalarray['val']['d.amount'] += $obj->subscription; + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['d.datec']['checked'])) + { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['d.tms']['checked'])) + { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Action column + print ''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print ''; + if (! $i) $totalarray['nbfield']++; + + print "\n"; + $i++; +} + +// Show total line +if (isset($totalarray['pos'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; + } + else print ''; + } + } + print ''; +} + +// If no record found +if ($num == 0) +{ + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; +} + +$db->free($resql); + +$parameters=array('sql' => $sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ""; +print ''; +print ''; + // End of page llxFooter(); diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 497d4748da8..031e4200268 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -397,7 +397,7 @@ print '

'; */ //if (! empty($conf->global->MAIN_FEATURES_LEVEL)) //{ -print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', ''); +print load_fiche_titre($langs->trans("Other"), '', ''); print "\n"; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 431d93e2a96..6cf9c84d265 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -63,7 +63,7 @@ if ($action == 'setcoder') $resql=$db->query($sqlp); if (! $resql) dol_print_error($db); } -else if ($action == 'update') +elseif ($action == 'update') { $location = GETPOST('GENBARCODE_LOCATION','alpha'); $res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity); @@ -71,17 +71,8 @@ else if ($action == 'update') $res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity); $coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha'); $res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity); -} -else if ($action == 'updateengine') -{ - // TODO Update engines. -} -if ($action && $action != 'setcoder' && $action != 'setModuleOptions') -{ - if (! $res > 0) $error++; - - if (! $error) + if ($res > 0) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -90,6 +81,42 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions') setEventMessages($langs->trans("Error"), null, 'errors'); } } +elseif ($action == 'updateengine') +{ + $sql = "SELECT rowid, coder"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " ORDER BY code"; + + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + if (GETPOST('coder'.$obj->rowid, 'alpha')) + { + $coder = GETPOST('coder'.$obj->rowid,'alpha'); + $code_id = $obj->rowid; + + $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; + $sqlp.= " SET coder = '" . $coder."'"; + $sqlp.= " WHERE rowid = ". $code_id; + $sqlp.= " AND entity = ".$conf->entity; + + $upsql=$db->query($sqlp); + if (! $upsql) dol_print_error($db); + } + + $i++; + } + } +} + /* * View @@ -161,9 +188,12 @@ foreach($dirbarcode as $reldir) print '
'; print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'',''); -//print ""; -//print ''; -//print ""; +if (empty($conf->use_javascript_ajax)) +{ + print ''; + print ''; + print ''; +} print '
'; print ''; @@ -258,10 +288,9 @@ print "
\n"; if (empty($conf->use_javascript_ajax)) { - // TODO Implement code behind action updateengine - //print '
'; + print '
'; + print ''; } -//print ''; print "
"; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index ff037f67aa1..2fb5013b4f9 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -380,11 +380,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $sourcedir = $object->source_directory; $targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag' - $connectstringserver = $object->getConnectStringIMAP(); - $connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); - $connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); + $connection = null; + $connectstringserver = ''; + $connectstringsource = ''; + $connectstringtarget = ''; + + if (function_exists('imap_open')) + { + $connectstringserver = $object->getConnectStringIMAP(); + $connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); + $connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); - $connection = imap_open($connectstringsource, $object->user, $object->password); + $connection = imap_open($connectstringsource, $object->user, $object->password); + } + else + { + $morehtml .= 'IMAP functions not available on your PHP'; + } + if (! $connection) { $morehtml .= 'Failed to open IMAP connection '.$connectstringsource; @@ -395,8 +408,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtml .= imap_num_msg($connection); } - imap_close($connection); - + if ($connection) + { + imap_close($connection); + } + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'
'.$morehtml.'
', '', 0, '', '', 0, ''); print '
'; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 945656962ea..79614cbd3a0 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -11,6 +11,7 @@ * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud + * Copyright (C) 2018 Frédéric France * * 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 @@ -447,8 +448,6 @@ $sql.=$db->plimit($listlimit+1,$offset); $fieldlist=explode(',',$tabfield[$id]); // Form to add a new line -$alabelisused=0; - print '
'; print ''; print ''; @@ -460,38 +459,37 @@ print ''; print ''; foreach ($fieldlist as $field => $value) { - // Determine le nom du champ par rapport aux noms possibles - // dans les dictionnaires de donnees - $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut - $valuetoshow=$langs->trans($valuetoshow); // try to translate - $align="left"; - if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");} - if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); } - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } - if ($fieldlist[$field]=='private') { $align='center'; } - if ($fieldlist[$field]=='position') { $align='center'; } + // Determine le nom du champ par rapport aux noms possibles + // dans les dictionnaires de donnees + $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut + $valuetoshow=$langs->trans($valuetoshow); // try to translate + $align="left"; + if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");} + if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); } + if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } + if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Code"); } + if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } + if ($fieldlist[$field]=='private') { $align='center'; } + if ($fieldlist[$field]=='position') { $align='center'; } - if ($fieldlist[$field]=='topic') { $valuetoshow=''; } - if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; } - if ($fieldlist[$field]=='content') { $valuetoshow=''; } - if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; } + if ($fieldlist[$field]=='topic') { $valuetoshow=''; } + if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; } + if ($fieldlist[$field]=='content') { $valuetoshow=''; } + if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; } - if ($valuetoshow != '') - { - print ''; - } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; + if ($valuetoshow != '') + { + print ''; + } } print ''; print ""; +// Show fields for topic, join files and body $fieldsforcontent = array('topic', 'joinfiles', 'content'); if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); } foreach ($fieldsforcontent as $tmpfieldlist) @@ -630,11 +629,11 @@ if ($resql) $filterfound=0; foreach ($fieldlist as $field => $value) { - if ($value == 'label') print ''; + if ($value == 'label') print ''; elseif ($value == 'lang') { print ''; } elseif ($value == 'fk_user') @@ -643,13 +642,13 @@ if ($resql) $restrictid=array(); if (! $user->admin) $restrictid=array($user->id); //var_dump($restrictid); - print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200'); + print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100'); print ''; } elseif ($value == 'topic') print ''; elseif ($value == 'type_template') { - print ''; + print ''; } elseif (! in_array($value, array('content', 'content_lines'))) print ''; } @@ -671,6 +670,7 @@ if ($resql) $align="left"; $sortable=1; $valuetoshow=''; + $forcenowrap=1; /* $tmparray=getLabelOfField($fieldlist[$field]); $showfield=$tmp['showfield']; @@ -688,7 +688,7 @@ if ($resql) if ($fieldlist[$field]=='private') { $align='center'; } if ($fieldlist[$field]=='position') { $align='center'; } - if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; } + if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; $forcenowrap=0; } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;} if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; } @@ -697,8 +697,8 @@ if ($resql) { if (! empty($tabhelp[$id][$value])) { - if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on click - else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); // Tooltip on hover + if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click + else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover } print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); } @@ -995,7 +995,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') print ''; } - elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; + elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; else { $size=''; $class=''; $classtd=''; if ($fieldlist[$field]=='code') $class='maxwidth100'; + if ($fieldlist[$field]=='label') $class='maxwidth100'; if ($fieldlist[$field]=='private') { $class='maxwidth50'; $classtd='center'; } if ($fieldlist[$field]=='position') { $class='maxwidth50'; $classtd='center'; } if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 4d5cc2be274..b16e9047b26 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -96,6 +96,7 @@ if ($action == 'update') $menu->perms=GETPOST('perms','alpha'); $menu->target=GETPOST('target','alpha'); $menu->user=GETPOST('user','alpha'); + $menu->mainmenu=GETPOST('propertymainmenu','alpha'); if (is_numeric(GETPOST('menuIdParent','alpha'))) { $menu->fk_menu=GETPOST('menuIdParent','alpha'); @@ -123,14 +124,11 @@ if ($action == 'update') setEventMessages($menu->error, $menu->errors, 'errors'); } $action = "edit"; - } - else - { + header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); exit; } - - if ($_GET['return']) + else { header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); exit; @@ -215,6 +213,7 @@ if ($action == 'add') $menu->perms=GETPOST('perms','alpha'); $menu->target=GETPOST('target','alpha'); $menu->user=GETPOST('user','alpha'); + $menu->mainmenu=GETPOST('propertymainmenu','alpha'); if (is_numeric(GETPOST('menuId','int'))) { $menu->fk_menu=GETPOST('menuId','int'); @@ -289,10 +288,13 @@ if ($action == 'create') { jQuery("#menuId").prop("disabled", true); jQuery("#menuId").val(\'\'); + jQuery("#propertymainmenu").removeAttr("disabled"); + jQuery("#propertymainmenu").val(\'\'); } - else + if (jQuery("#topleft").val() == \'left\') { jQuery("#menuId").removeAttr("disabled"); + jQuery("#propertymainmenu").prop("disabled", true); } } init_topleft(); @@ -338,7 +340,7 @@ if ($action == 'create') print ''; print ''; - //User + // User print ''; print ''; + // Mainmenu code + print ''; + print ''; + print ''; + // MenuId Parent print ''; if ($parent_rowid) @@ -373,23 +381,23 @@ if ($action == 'create') } else { - print ''; + print ''; } print ''; // Title - print ''; + print ''; // URL - print ''; + print ''; // Langs - print ''; + print ''; // Position - print ''; + print ''; // Target print ''; // Enabled - print ''; + print ''; // Perms - print ''; + print ''; print '
'; - if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; - else if (! empty($tabhelp[$id][$value])) - { - if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click - else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover - } - else print $valuetoshow; - print ''; + if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; + else if (! empty($tabhelp[$id][$value])) + { + if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click + else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover + } + else print $valuetoshow; + print ''; print ''; @@ -534,6 +532,7 @@ print ''; print '
'; - print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150'); + print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100'); print ''.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200 maxwidth100onsmartphone').''.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').''; if (! empty($conf->global->MAIN_MULTILANGS)) { - $selectedlang = GETPOSTISSET('langcode','aZ09')?GETPOST('langcode','aZ09'):$langs->defaultlang; + $selectedlang = GETPOSTISSET('langcode')?GETPOST('langcode', 'aZ09'):$langs->defaultlang; if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]}; print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150'); } @@ -1023,17 +1023,18 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } else { - print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200'); + print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150 maxwidth100onsmartphone'); } print ''.$langs->trans('DetailMenuHandler').'
'.$langs->trans('MenuForUsers').''; } - // print ''; print ''.$langs->trans('DetailType').'
'.$langs->trans('MainMenuCode').''; + print $langs->trans("Example").': mytopmenukey'; + print '
'.$langs->trans('MenuIdParent').''.$langs->trans('DetailMenuIdParent'); print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; print '
'.$langs->trans('Title').''.$langs->trans('DetailTitre').'
'.$langs->trans('Title').''.$langs->trans('DetailTitre').'
'.$langs->trans('URL').''.$langs->trans('DetailUrl').'
'.$langs->trans('URL').''.$langs->trans('DetailUrl').'
'.$langs->trans('LangFile').''.$langs->trans('DetailLangs').'
'.$langs->trans('LangFile').''.$langs->trans('DetailLangs').'
'.$langs->trans('Position').''.$langs->trans('DetailPosition').'
'.$langs->trans('Position').''.$langs->trans('DetailPosition').'
'.$langs->trans('Target').''.$langs->trans('DetailTarget').'
'.$langs->trans('Enabled').''.$langs->trans('DetailEnabled').'
'.$langs->trans('Enabled').''.$langs->trans('DetailEnabled').'
'.$langs->trans('Rights').''.$langs->trans('DetailRight').'
'.$langs->trans('Rights').''.$langs->trans('DetailRight').'
'; @@ -455,13 +463,30 @@ elseif ($action == 'edit') // Type print ''.$langs->trans('Type').''.$langs->trans(ucfirst($menu->type)).''.$langs->trans('DetailType').''; + // Mainmenu code + if ($menu->type == 'top') + { + print ''.$langs->trans('MainMenuCode').''; + /*if ($parent_rowid) + { + print ''.$parent_rowid.''; + } + else + {*/ + print 'mainmenu).'">'; + //} + print ''; + print $langs->trans("Example").': mytopmenukey'; + print ''; + } + // MenuId Parent print ''.$langs->trans('MenuIdParent'); print ''; $valtouse=$menu->fk_menu; if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu; if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu; - print ''; + print ''; print ''.$langs->trans('DetailMenuIdParent'); print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; print ''; @@ -470,16 +495,16 @@ elseif ($action == 'edit') //print ''.$langs->trans('Level').''.$menu->level.''.$langs->trans('DetailLevel').''; // Title - print ''.$langs->trans('Title').''.$langs->trans('DetailTitre').''; + print ''.$langs->trans('Title').''.$langs->trans('DetailTitre').''; // Url print ''.$langs->trans('URL').''.$langs->trans('DetailUrl').''; // Langs - print ''.$langs->trans('LangFile').''.$langs->trans('DetailLangs').''; + print ''.$langs->trans('LangFile').''.$langs->trans('DetailLangs').''; // Position - print ''.$langs->trans('Position').''.$langs->trans('DetailPosition').''; + print ''.$langs->trans('Position').''.$langs->trans('DetailPosition').''; // Target print ''.$langs->trans('Target').''.$langs->trans('DetailTarget').''; // Enabled - print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled'); + print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled'); if (! empty($menu->enabled)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->enabled,1)).')'; print ''; // Perms - print ''.$langs->trans('Rights').''.$langs->trans('DetailRight'); + print ''.$langs->trans('Rights').''.$langs->trans('DetailRight'); if (! empty($menu->perms)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->perms,1)).')'; print ''; diff --git a/htdocs/admin/socialnetworks.php b/htdocs/admin/socialnetworks.php index 9aba26b3fc4..959dd91f339 100644 --- a/htdocs/admin/socialnetworks.php +++ b/htdocs/admin/socialnetworks.php @@ -89,7 +89,7 @@ dol_fiche_head($head, 'setup', '', 0, 'user'); print '
'; -$arrayofsocialnetworks=array('skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook'); +$arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook'); foreach($arrayofsocialnetworks as $snkey => $snlabel) { diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 3c242e8048f..55be556afb9 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -517,7 +517,6 @@ print '
';
2 -
trans("BackupDesc2",DOL_DATA_ROOT).'
'; @@ -525,6 +524,13 @@ print $langs->trans("BackupDescX").'

'; ?> +
+ +trans("BackupDumpWizard")); +?> +
" />

+ '; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index ad7128c31ef..fba393edc08 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -65,7 +65,7 @@ class Categorie extends CommonObject * * @note This array should be remove in future, once previous constants are moved to the string value. Deprecated */ - private $MAP_ID = array( + protected $MAP_ID = array( 'product' => 0, 'supplier' => 1, 'customer' => 2, @@ -97,7 +97,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - private $MAP_CAT_FK = array( + protected $MAP_CAT_FK = array( 'product' => 'product', 'customer' => 'soc', 'supplier' => 'soc', @@ -114,7 +114,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - private $MAP_CAT_TABLE = array( + protected $MAP_CAT_TABLE = array( 'product' => 'product', 'customer' => 'societe', 'supplier' => 'fournisseur', @@ -131,7 +131,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - private $MAP_OBJ_CLASS = array( + protected $MAP_OBJ_CLASS = array( 'product' => 'Product', 'customer' => 'Societe', 'supplier' => 'Fournisseur', @@ -148,7 +148,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - private $MAP_OBJ_TABLE = array( + protected $MAP_OBJ_TABLE = array( 'product' => 'product', 'customer' => 'societe', 'supplier' => 'societe', @@ -944,7 +944,7 @@ class Categorie extends CommonObject * * @return int <0 if KO, >0 if OK */ - private function load_motherof() + protected function load_motherof() { // phpcs:enable global $conf; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index aef77513e7b..af6ead5017b 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1292,7 +1292,8 @@ class ActionComm extends CommonObject $tooltip .= '
' . $langs->trans('Type') . ': ' . $labeltype; if (! empty($this->location)) $tooltip .= '
' . $langs->trans('Location') . ': ' . $this->location; - + if (! empty($this->note)) + $tooltip .= '
' . $langs->trans('Note') . ': ' . $this->note; $linkclose=''; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) $linkclose = ' style="background-color:#'.$this->type_color.'"'; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 57d6adc1ba9..84c1f5954b9 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -72,7 +72,7 @@ $object = new Mailing($db); if ($action == 'add') { - $module=GETPOST("module"); + $module=GETPOST("module",'alpha'); $result=-1; foreach ($modulesdir as $dir) @@ -89,14 +89,10 @@ if ($action == 'add') { require_once $file; - // We fill $filtersarray. Using this variable is now deprecated. Kept for backward compatibility. - $filtersarray=array(); - if (isset($_POST["filter"])) $filtersarray[0]=$_POST["filter"]; - // Add targets into database $obj = new $classname($db); dol_syslog("Call add_to_target on class ".$classname); - $result=$obj->add_to_target($id,$filtersarray); + $result=$obj->add_to_target($id); } } if ($result > 0) @@ -329,14 +325,16 @@ if ($object->fetch($id) >= 0) // Si le module mailing est qualifie if ($qualified) { + $var = ! $var; + if ($allowaddtarget) { - print ''; + print ''; print ''; } else { - print '
'; + print '
'; } print '
'; diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index baf48447bad..83833304d44 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -745,7 +745,16 @@ class AdvanceTargetingMailing extends CommonObject $sqlwhere[]= " (t.civility IN ('".$this->db->escape(implode("','",$arrayquery['contact_civility']))."'))"; } if ($arrayquery['contact_no_email']!='') { - $sqlwhere[]= " (t.no_email='".$this->db->escape($arrayquery['contact_no_email'])."')"; + $tmpwhere = ''; + if (! empty($arrayquery['contact_no_email'])) + { + $tmpwhere.= "(t.email IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))"; + } + else + { + $tmpwhere.= "(t.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))"; + } + $sqlwhere[]= $tmpwhere; } if ($arrayquery['contact_update_st_dt']!='') { $sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')"; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 4ab6c71819f..21caa0d4db8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -14,6 +14,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Ferran Marcet * * 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 @@ -438,38 +439,40 @@ class Propal extends CommonObject global $mysoc, $conf, $langs; dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except); - include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - - // Clean parameters - if (empty($remise_percent)) $remise_percent=0; - if (empty($qty)) $qty=0; - if (empty($info_bits)) $info_bits=0; - if (empty($rang)) $rang=0; - if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; - - $remise_percent=price2num($remise_percent); - $qty=price2num($qty); - $pu_ht=price2num($pu_ht); - $pu_ht_devise=price2num($pu_ht_devise); - $pu_ttc=price2num($pu_ttc); - $txtva=price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' - $txlocaltax1=price2num($txlocaltax1); - $txlocaltax2=price2num($txlocaltax2); - $pa_ht=price2num($pa_ht); - if ($price_base_type=='HT') - { - $pu=$pu_ht; - } - else - { - $pu=$pu_ttc; - } - - // Check parameters - if ($type < 0) return -1; - if ($this->statut == self::STATUS_DRAFT) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + + // Clean parameters + if (empty($remise_percent)) $remise_percent=0; + if (empty($qty)) $qty=0; + if (empty($info_bits)) $info_bits=0; + if (empty($rang)) $rang=0; + if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; + + $remise_percent=price2num($remise_percent); + $qty=price2num($qty); + $pu_ht=price2num($pu_ht); + $pu_ht_devise=price2num($pu_ht_devise); + $pu_ttc=price2num($pu_ttc); + if (!preg_match('/\((.*)\)/', $txtva)) { + $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' + } + $txlocaltax1=price2num($txlocaltax1); + $txlocaltax2=price2num($txlocaltax2); + $pa_ht=price2num($pa_ht); + if ($price_base_type=='HT') + { + $pu=$pu_ht; + } + else + { + $pu=$pu_ttc; + } + + // Check parameters + if ($type < 0) return -1; + $this->db->begin(); $product_type=$type; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3dc168f14c5..5b3f8006345 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -9,8 +9,8 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García - * Copyright (C) 2016-2017 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2016-2018 Ferran Marcet * * 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 @@ -1312,45 +1312,47 @@ class Commande extends CommonOrder $logtext.= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise"; dol_syslog(get_class($this).$logtext, LOG_DEBUG); - include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - - // Clean parameters - if (empty($remise_percent)) $remise_percent=0; - if (empty($qty)) $qty=0; - if (empty($info_bits)) $info_bits=0; - if (empty($rang)) $rang=0; - if (empty($txtva)) $txtva=0; - if (empty($txlocaltax1)) $txlocaltax1=0; - if (empty($txlocaltax2)) $txlocaltax2=0; - if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; - if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0; - - $remise_percent=price2num($remise_percent); - $qty=price2num($qty); - $pu_ht=price2num($pu_ht); - $pu_ht_devise=price2num($pu_ht_devise); - $pu_ttc=price2num($pu_ttc); - $pa_ht=price2num($pa_ht); - $txtva = price2num($txtva); - $txlocaltax1 = price2num($txlocaltax1); - $txlocaltax2 = price2num($txlocaltax2); - if ($price_base_type=='HT') - { - $pu=$pu_ht; - } - else - { - $pu=$pu_ttc; - } - $label=trim($label); - $desc=trim($desc); - - // Check parameters - if ($type < 0) return -1; - if ($this->statut == self::STATUS_DRAFT) { - $this->db->begin(); + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + + // Clean parameters + if (empty($remise_percent)) $remise_percent=0; + if (empty($qty)) $qty=0; + if (empty($info_bits)) $info_bits=0; + if (empty($rang)) $rang=0; + if (empty($txtva)) $txtva=0; + if (empty($txlocaltax1)) $txlocaltax1=0; + if (empty($txlocaltax2)) $txlocaltax2=0; + if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; + if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0; + + $remise_percent=price2num($remise_percent); + $qty=price2num($qty); + $pu_ht=price2num($pu_ht); + $pu_ht_devise=price2num($pu_ht_devise); + $pu_ttc=price2num($pu_ttc); + $pa_ht=price2num($pa_ht); + if (!preg_match('/\((.*)\)/', $txtva)) { + $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' + } + $txlocaltax1 = price2num($txlocaltax1); + $txlocaltax2 = price2num($txlocaltax2); + if ($price_base_type=='HT') + { + $pu=$pu_ht; + } + else + { + $pu=$pu_ttc; + } + $label=trim($label); + $desc=trim($desc); + + // Check parameters + if ($type < 0) return -1; + + $this->db->begin(); $product_type=$type; if (!empty($fk_product)) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 94885ab118b..f20925d7c12 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -634,7 +634,7 @@ if ($resql) } // Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not) - if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1) + if (! empty($conf->global->BANK_REPORT_LAST_NUM_RELEVE)) { print '