diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index a223d4b35ba..0eaa3efff8f 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2012 Marcos GarcĂ­a * Copyright (C) 2012-2016 Philippe Grand * Copyright (C) 2015-2016 Alexandre Spangaro @@ -301,7 +301,7 @@ if (empty($reshook)) $object->phone = trim(GETPOST("phone",'alpha')); $object->phone_perso = trim(GETPOST("phone_perso",'alpha')); $object->phone_mobile= trim(GETPOST("phone_mobile",'alpha')); - $object->email = trim(GETPOST("member_email",'alpha')); + $object->email = preg_replace('/\s+/', '', GETPOST("member_email",'alpha')); $object->skype = trim(GETPOST("skype",'alpha')); $object->birth = $birthdate; @@ -445,7 +445,7 @@ if (empty($reshook)) $phone_perso=GETPOST("phone_perso",'alpha'); $phone_mobile=GETPOST("phone_mobile",'alpha'); $skype=GETPOST("member_skype",'alpha'); - $email=GETPOST("member_email",'alpha'); + $email=preg_replace('/\s+/', '', GETPOST("member_email",'alpha')); $login=GETPOST("member_login",'alpha'); $pass=GETPOST("password",'alpha'); $photo=GETPOST("photo",'alpha'); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index fd418756bd6..c9e3d1936c6 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -48,9 +48,6 @@ $subscriptionstatic=new Subscription($db); print load_fiche_titre($langs->trans("MembersArea")); - -$var=True; - $Adherents=array(); $AdherentsAValider=array(); $MemberUpToDate=array(); @@ -255,7 +252,6 @@ print ''.$langs->trans("AmountTotal").''; print ''.$langs->trans("AmountAverage").''; print "\n"; -$var=true; krsort($Total); foreach ($Total as $key=>$value) { diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 6ae8058c189..c92b66e8bc2 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -345,6 +345,12 @@ if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs- if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); +$newcardbutton=''; +if ($user->rights->adherent->creer) +{ + $newcardbutton=''.$langs->trans('NewMember').''; +} + print '
'; if ($optioncss != '') print ''; print ''; @@ -355,7 +361,7 @@ print ''; print ''; print ''; -print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); $topicmail="Information"; $modelmail="member"; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 1ed0b9a5c50..2a6c4fe2d71 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -181,6 +181,8 @@ if ($result) if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + $newcardbutton=''.$langs->trans('NewSubscription').''; + print ''; if ($optioncss != '') print ''; print ''; @@ -191,7 +193,7 @@ if ($result) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); $topicmail="Information"; $modelmail="subscription"; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 48df382181d..929dc706042 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -228,6 +228,12 @@ if (! $rowid && $action != 'create' && $action != 'edit') $param = ''; + $newcardbutton=''; + if ($user->rights->adherent->configurer) + { + $newcardbutton=''.$langs->trans('NewMemberType').''; + } + print ''; if ($optioncss != '') print ''; print ''; @@ -237,7 +243,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; - print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); + print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); $moreforfilter = ''; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 79c4d4765be..d0de3d2002f 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -55,8 +55,7 @@ $search_lang=GETPOST('search_lang','alpha'); $search_fk_user=GETPOST('search_fk_user','intcomma'); $search_topic=GETPOST('search_topic','alpha'); -$allowed=1; -if (! $allowed) accessforbidden(); +if (! empty($user->socid)) accessforbidden(); $acts[0] = "activate"; $acts[1] = "disable"; @@ -168,6 +167,7 @@ if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$la if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty'); if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember'); if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract'); +if ($conf->projet->enabled) $elementList['project']=$langs->trans('MailToProject'); $elementList['user']=$langs->trans('MailToUser'); $elementList['all'] =$langs->trans('VisibleEverywhere'); $elementList['none']=$langs->trans('VisibleNowhere'); @@ -521,7 +521,7 @@ $parameters = array( 'fieldlist' => $fieldlist, 'tabname' => $tabname[$id] ); -$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; @@ -732,7 +732,7 @@ if ($resql) { $tmpaction='edit'; $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('editEmailTemplateFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; // Show fields @@ -791,7 +791,7 @@ if ($resql) { $tmpaction = 'view'; $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('viewEmailTemplateFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index db8251d0562..22925f09a3e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -79,9 +79,9 @@ $familyinfo=array( $param=''; if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword); -if ($search_status > -1) $param.='&search_status='.urlencode($search_status); -if ($search_nature > -1) $param.='&search_nature='.urlencode($search_nature); -if ($search_version > -1) $param.='&search_version='.urlencode($search_version); +if ($search_status && $search_status != '-1') $param.='&search_status='.urlencode($search_status); +if ($search_nature && $search_nature != '-1') $param.='&search_nature='.urlencode($search_nature); +if ($search_version && $search_version != '-1') $param.='&search_version='.urlencode($search_version); $dirins=DOL_DOCUMENT_ROOT.'/custom'; $urldolibarrmodules='https://www.dolistore.com/'; @@ -462,7 +462,7 @@ if ($mode == 'common') { dol_set_focus('#search_keyword'); - print ''; + print ''; if ($optioncss != '') print ''; print ''; print ''; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index fdf0e9f9bee..339b4fef566 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -257,17 +257,6 @@ print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$con print ''; print "\n"; -// Add js auto fill amount on paiement form -/* always on now -$var=! $var; -print ''; -print $langs->trans("JSOnPaimentBill"); -print ''; -print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); -print ''; -print "\n"; -*/ - print ''; print '
'; diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 54a91d6ee92..e3854c4eb11 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -64,7 +64,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('admin')); +$hookmanager->initHooks(array('website')); // Name of SQL tables of dictionaries $tabname=array(); @@ -514,15 +514,7 @@ if ($id) } } - $tmpaction = 'create'; - $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=$hookmanager->errors; - - if (empty($reshook)) - { - fieldListWebsites($fieldlist,$obj,$tabname[$id],'add'); - } + fieldListWebsites($fieldlist,$obj,$tabname[$id],'add'); print ''; if ($action != 'edit') @@ -602,7 +594,7 @@ if ($id) { $tmpaction='edit'; $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('editWebsiteFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; if (empty($reshook)) fieldListWebsites($fieldlist,$obj,$tabname[$id],'edit'); @@ -614,7 +606,7 @@ if ($id) { $tmpaction = 'view'; $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); - $reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('viewWebsiteFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 2aa3024920f..b1262b7a554 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -81,7 +81,9 @@ $userstatic=new User($db); llxHeader('', $langs->trans("ListOfBookmarks")); -print load_fiche_titre($langs->trans("ListOfBookmarks")); +$newcardbutton=''.$langs->trans('NewBookmark').''; + +print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton); $sql = "SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,"; $sql.= " u.login, u.lastname, u.firstname"; @@ -204,16 +206,6 @@ else } - -print "
\n"; - -if ($user->rights->bookmark->creer) -{ - print ''.$langs->trans("NewBookmark").''; -} - -print '
'; - llxFooter(); $db->close(); diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index f2491b09336..4b01ddfaba8 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -103,7 +103,10 @@ if ($result) $title=$langs->trans("ListOfEMailings"); if ($filteremail) $title.=' ('.$langs->trans("SentTo",$filteremail).')'; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,"",$num); + + $newcardbutton=''.$langs->trans('NewMailing').''; + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '',$num, '', 'title_generic.png', 0, $newcardbutton); $i = 0; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3e62d8d0298..3259654ebcc 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -394,6 +394,12 @@ if ($resql) if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + $newcardbutton=''; + if ($user->rights->propal->creer) + { + $newcardbutton=''.$langs->trans('NewPropal').''; + } + // Lignes des champs de filtre print ''; if ($optioncss != '') print ''; @@ -405,7 +411,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit); $topicmail="SendPropalRef"; $modelmail="proposal_send"; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index e2f13032e05..a13d80c083c 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -52,18 +52,18 @@ foreach($linkedObjectBlock as $key => $objectlink) $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - - trans("Proposal"); ?> - getNomUrl(1); ?> - ref_client; ?> - date,'day'); ?> - " data-element="element; ?>" data-id="id; ?>" > + trans("Proposal"); ?> + getNomUrl(1); ?> + ref_client; ?> + date,'day'); ?> + rights->propale->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> rights->commande->creer) /* * Form to add new line */ - if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer) + if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer && $action != 'selectlines') { if ($action != 'editline') { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index fa5cdb15633..8048d5a618f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -419,6 +419,12 @@ if ($resql) if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + $newcardbutton=''; + if ($contextpage == 'orderlist' && $user->rights->commande->creer) + { + $newcardbutton=''.$langs->trans('NewOrder').''; + } + // Lines of title fields print ''; if ($optioncss != '') print ''; @@ -431,7 +437,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit); $topicmail="SendOrderRef"; $modelmail="order_send"; diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index e1f40f16220..d481ac32d90 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -47,18 +47,20 @@ foreach($linkedObjectBlock as $key => $objectlink) $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - - trans("CustomerOrder"); ?> - getNomUrl(1); ?> - ref_client; ?> - date,'day'); ?> - " > + trans("CustomerOrder"); ?> + global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print ' + + getNomUrl(1); ?> + ref_client; ?> + date,'day'); ?> + rights->commande->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?> - getLibStatut(3); ?> - + getLibStatut(3); ?> + element != 'shipping') { diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 5e24463566c..aa47d714bd9 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -153,6 +153,8 @@ if ($result) if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + $newcardbutton=''.$langs->trans('MenuNewVariousPayment').''; + print ''; if ($optioncss != '') print ''; @@ -163,7 +165,7 @@ if ($result) print ''; print ''; - print_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); + print_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit); print '
'; print ''."\n"; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d438c505a8d..9113115b42d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2095,6 +2095,82 @@ if (empty($reshook)) exit(); } + // add lines from objectlinked + elseif($action == 'import_lines_from_object' + && $user->rights->facture->creer + && $object->statut == Facture::STATUS_DRAFT + && ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION)) + { + $fromElement = GETPOST('fromelement'); + $fromElementid = GETPOST('fromelementid'); + $importLines = GETPOST('line_checkbox'); + + if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid)) + { + if($fromElement == 'commande') + { + dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class'); + $lineClassName = 'OrderLine'; + } + $nextRang = count($object->lines) + 1; + $importCount = 0; + $error = 0; + foreach($importLines as $lineId) + { + $lineId = intval($lineId); + $originLine = new $lineClassName($db); + if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0) + { + $originLine->fetch_optionals($lineId); + $desc = $originLine->desc; + $pu_ht = $originLine->subprice; + $qty = $originLine->qty; + $txtva = $originLine->tva_tx; + $txlocaltax1 = $originLine->localtax1_tx; + $txlocaltax2 = $originLine->localtax2_tx; + $fk_product = $originLine->fk_product; + $remise_percent = $originLine->remise_percent; + $date_start = $originLine->date_start; + $date_end = $originLine->date_end; + $ventil = 0; + $info_bits = $originLine->info_bits; + $fk_remise_except = $originLine->fk_remise_except; + $price_base_type='HT'; + $pu_ttc=0; + $type = $originLine->product_type; + $rang=$nextRang++; + $special_code = $originLine->special_code; + $origin = $originLine->element; + $origin_id = $originLine->id; + $fk_parent_line=0; + $fk_fournprice=$originLine->fk_fournprice; + $pa_ht = $originLine->pa_ht; + $label = $originLine->label; + $array_options = $originLine->array_options; + $situation_percent = 100; + $fk_prev_id = ''; + $fk_unit = $originLine->fk_unit; + $pu_ht_devise = $originLine->multicurrency_subprice; + + $res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $ventil, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $type, $rang, $special_code, $origin, $origin_id, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $situation_percent, $fk_prev_id, $fk_unit,$pu_ht_devise); + if($res > 0){ + $importCount++; + }else{ + $error++; + } + } + else{ + $error++; + } + } + + if($error) + { + setEventMessage($langs->trans('ErrorsOnXLines',$error), 'errors'); + } + } + } + // Actions when printing a doc from card include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; @@ -4156,7 +4232,7 @@ else if ($id > 0 || ! empty($ref)) // Form to add new line if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline' && ($object->is_first() || !$object->situation_cycle_ref)) { - if ($action != 'editline') + if ($action != 'editline' && $action != 'selectlines') { // Add free products/services $object->formAddObjectLine(1, $mysoc, $soc); @@ -4448,8 +4524,16 @@ else if ($id > 0 || ! empty($ref)) // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - + + $compatibleImportElementsList = false; + if($user->rights->facture->creer + && $object->statut == Facture::STATUS_DRAFT + && ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) ) + { + $compatibleImportElementsList = array('commande'); // import from linked elements + } + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList); + // Show online payment link $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0e8217c2bf8..77238e5b62d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -769,10 +769,16 @@ class Facture extends CommonInvoice } else if ($reshook < 0) $error++;*/ - // Call trigger - $result=$this->call_trigger('BILL_CREATE',$user); - if ($result < 0) $error++; - // End call triggers + if (! $error) + { + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('BILL_CREATE',$user); + if ($result < 0) $error++; + // End call triggers + } + } if (! $error) { diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index b96c1220f52..32dfd03a8bf 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -589,6 +589,12 @@ if ($resql) if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + $newcardbutton=''; + if($user->rights->facture->creer) + { + $newcardbutton=''.$langs->trans('NewBill').''; + } + $i = 0; print ''."\n"; @@ -602,7 +608,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); + print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit); $topicmail="SendBillRef"; $modelmail="facture_send"; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index d2dd999350d..3964800fd2b 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -47,12 +47,12 @@ foreach($linkedObjectBlock as $key => $objectlink) $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - - - - - - + + + + - - + + 1) } ?> - \ No newline at end of file + diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 76c52215281..532d2e4c9b8 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -131,6 +131,12 @@ if ($resql) if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + $newcardbutton=''; + if ($user->rights->banque->cheque) + { + $newcardbutton = ''.$langs->trans('NewCheckDeposit').''; + } + print ''; if ($optioncss != '') print ''; print ''; @@ -140,7 +146,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', '', '', $limit); + print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', 0, $newcardbutton, '', $limit); $moreforfilter=''; diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 9d3da39e5c3..31dfbd5b610 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -101,6 +101,8 @@ if ($result) $selectedfields=''; + $newcardbutton = ''.$langs->trans('NewStandingOrder').''; + // Lines of title fields print ''; if ($optioncss != '') print ''; @@ -112,7 +114,7 @@ if ($result) print ''; print ''; - print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); + print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit); $moreforfilter=''; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 4cad9117040..f9b9adf616c 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -150,6 +150,8 @@ if ($result) if ($typeid) $param.='&typeid='.$typeid; if ($optioncss != '') $param.='&optioncss='.$optioncss; + $newcardbutton=''.$langs->trans('NewSalaryPayment').''; + print ''; if ($optioncss != '') print ''; print ''; @@ -159,7 +161,7 @@ if ($result) print ''; print ''; - print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); + print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit); print '
'; print '
trans("CustomerInvoice"); ?>getNomUrl(1); ?>ref_client; ?>date,'day'); ?>" data-element="element; ?>" data-id="id; ?>" > + trans("CustomerInvoice"); ?>getNomUrl(1); ?>ref_client; ?>date,'day'); ?>rights->facture->lire) { $sign = 1; if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1; @@ -66,8 +66,8 @@ foreach($linkedObjectBlock as $key => $objectlink) echo ''.price($objectlink->total_ht).''; } } ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'."\n"; diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 281a0afb377..3850ddfe5c5 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -146,6 +146,12 @@ if ($resql) if ($year) $param.='&year='.$year; if ($typeid) $param.='&typeid='.$typeid; + $newcardbutton=''; + if($user->rights->tax->charges->creer) + { + $newcardbutton=''.$langs->trans('MenuNewSocialContribution').''; + } + print ''; if ($optioncss != '') print ''; print ''; @@ -158,11 +164,11 @@ if ($resql) if ($year) { $center=($year?"".img_previous()." ".$langs->trans("Year")." $year ".img_next()."":""); - print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); + print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit); } else { - print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); + print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit); } if (empty($mysoc->country_id) && empty($mysoc->country_code)) diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 8f2044369a1..056e16b4d5b 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -148,6 +148,11 @@ if ($result) if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($typeid) $param.='&typeid='.$typeid; + $newcardbutton=''; + if ($user->rights->tax->charges->creer) + { + $newcardbutton=''.$langs->trans('NewVATPayment').''; + } print ''; if ($optioncss != '') print ''; @@ -157,7 +162,7 @@ if ($result) print ''; print ''; - print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy', 0, $newcardbutton, '', $limit); print '
'; print '
'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 92e3f72595e..5c101401dac 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -412,6 +412,12 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs-> if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); +$newcardbutton=''; +if ($user->rights->societe->contact->creer) +{ + $newcardbutton=''.$langs->trans('NewContactAddress').''; +} + print ''; if ($optioncss != '') print ''; print ''; @@ -421,7 +427,7 @@ print ''; print ''; print ''; -print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit); +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, $newcardbutton, '', $limit); $topicmail="Information"; $modelmail="contact"; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 58fa3287c9a..b1755b7f7ec 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -369,6 +369,12 @@ if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs-> if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); +$newcardbutton=''; +if ($user->rights->contrat->creer) +{ + $newcardbutton=''.$langs->trans('NewContractSubscription').''; +} + print ''; if ($optioncss != '') print ''; print ''; @@ -378,7 +384,7 @@ print ''; print ''; print ''; -print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit); +print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, $newcardbutton, '', $limit); $topicmail="SendContractRef"; $modelmail="contract"; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 47af9ba4ae0..af3dce343f4 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -776,7 +776,8 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); $res=false; } else { - $this->error = sprintf ("Sent %d messages\n", $result); + $this->error = $langs->trans("SentXXXmessages", $result); + $this->errors[] = $langs->trans("SentXXXmessages", $result); } } else diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5bdc58cc61a..a620afd900b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1428,19 +1428,24 @@ abstract class CommonObject if (empty($format)) $format='text'; if (empty($id_field)) $id_field='rowid'; + $fk_user_field = 'fk_user_modif'; + $error=0; $this->db->begin(); // Special case if ($table == 'product' && $field == 'note_private') $field='note'; + if (in_array($table, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { + $fk_user_field = 'fk_user_mod'; + } $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET "; if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value); else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); - if (! empty($fuser) && is_object($fuser)) $sql.=", fk_user_modif = ".$fuser->id; - elseif (empty($fuser) || $fuser != 'none') $sql.=", fk_user_modif = ".$user->id; + if (! empty($fuser) && is_object($fuser)) $sql.=", ".$fk_user_field." = ".$fuser->id; + elseif (empty($fuser) || $fuser != 'none') $sql.=", ".$fk_user_field." = ".$user->id; $sql.= " WHERE ".$id_field." = ".$id; dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); @@ -2437,11 +2442,13 @@ abstract class CommonObject if (! $this->table_element) { + $this->error='update_note was called on objet with property table_element not defined'; dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR); return -1; } if (! in_array($suffix,array('','_public','_private'))) { + $this->error='update_note Parameter suffix must be empty, \'_private\' or \'_public\''; dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR); return -2; } @@ -3728,6 +3735,14 @@ abstract class CommonObject print ''; + if($action == 'selectlines') + { + print ''; + } + print "\n"; } @@ -4991,6 +5006,7 @@ abstract class CommonObject if ($error) { + dol_syslog(get_class($this) . "::".__METHOD__ . $this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -5978,19 +5994,29 @@ abstract class CommonObject else { $csstyle=''; - $class=(!empty($extrafields->attribute_hidden[$key]) ? 'class="hideobject" ' : ''); + $class=(!empty($extrafields->attribute_hidden[$key]) ? 'hideobject ' : ''); if (is_array($params) && count($params)>0) { if (array_key_exists('style',$params)) { $csstyle=$params['style']; } } - $out .= ''; - if (empty($onetrtd)) + // add html5 elements + $domData = ' data-element="extrafield"'; + $domData .= ' data-targetelement="'.$this->element.'"'; + $domData .= ' data-targetid="'.$this->id.'"'; + + $html_id = !empty($this->id) ? 'extrarow-'.$this->element.'_'.$key.'_'.$this->id : ''; + + $out .= ''; + + if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; } } + if($action == 'selectlines'){ $colspan++; } + // Convert date into timestamp format (value in memory must be a timestamp) if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) { @@ -6009,16 +6035,10 @@ abstract class CommonObject $labeltoshow = ''.$labeltoshow.''; } - if (empty($onetrtd)) $out .= ''; - else $out.=' '; + $out .= ''; $html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : ''; - $out .=''; + $out .=''; - $out .= ''; + if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= ''; + else $out .= ''; $e++; } } @@ -6043,7 +6064,7 @@ abstract class CommonObject jQuery(document).ready(function() { function showOptions(child_list, parent_list) { - var val = $("select[name="+parent_list+"]").val(); + var val = $("select[name=\"options_"+parent_list+"\"]").val(); var parentVal = parent_list + ":" + val; if(val > 0) { $("select[name=\""+child_list+"\"] option[parent]").hide(); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d2177dfa33b..bf9bcf587f8 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -740,6 +740,7 @@ class ExtraFields if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label; // Set array of label of entity + // TODO Remove completely loading of label. This should be done by presentation. $labelmulticompany=array(); if (!empty($conf->multicompany->enabled)) { @@ -757,8 +758,7 @@ class ExtraFields // We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management. dol_syslog("fetch_name_optionals_label elementtype=".$elementtype); - $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed"; - $sql.= ",entity"; + $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " WHERE entity IN (0,".$conf->entity.")"; if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 8b8ae3651df..8cc2c62bee7 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -134,28 +134,29 @@ class HookManager if (in_array( $method, array( - 'addCalendarChoice', - 'addMoreActionsButtons', - 'addMoreMassActions', - 'addSearchEntry', + 'addCalendarChoice', + 'addMoreActionsButtons', + 'addMoreMassActions', + 'addSearchEntry', 'addStatisticLine', - 'createDictionaryFieldList', + 'createDictionaryFieldlist', 'editDictionaryFieldlist', 'getFormMail', - 'deleteFile', + 'deleteFile', 'doActions', - 'doMassActions', + 'doMassActions', + 'formatEvent', 'formCreateThirdpartyOptions', 'formObjectOptions', 'formattachOptions', 'formBuilddocLineOptions', - 'formatNotificationMessage', - 'getFormMail', - 'getIdProfUrl', - 'getDirList', + 'formatNotificationMessage', + 'getFormMail', + 'getIdProfUrl', + 'getDirList', 'moveUploadedFile', 'moreHtmlStatus', - 'pdf_build_address', + 'pdf_build_address', 'pdf_writelinedesc', 'pdf_getlinenum', 'pdf_getlineref', @@ -176,12 +177,11 @@ class HookManager 'printAddress', 'printSearchForm', 'printTabsHead', - 'formatEvent', - 'printObjectLine', - 'printObjectSubLine', - 'showLinkToObjectBlock', + 'printObjectLine', + 'printObjectSubLine', 'sendMail', - 'sendMailAfter' + 'sendMailAfter', + 'showLinkToObjectBlock' ) )) $hooktype='addreplace'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index aa27be2d727..c7fa142daf1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1703,7 +1703,10 @@ class Form $userstatic->fetch($value['id']); $out.= $userstatic->getNomUrl(-1); if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; } - if ($nbassignetouser > 1 && $action != 'view') $out.=' '; + if ($nbassignetouser > 1 && $action != 'view') + { + $out.=' '; + } // Show my availability if ($showproperties) { @@ -5985,9 +5988,10 @@ class Form * * @param CommonObject $object Object we want to show links to * @param string $morehtmlright More html to show on right of title + * @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action * @return int <0 if KO, >=0 if OK */ - function showLinkedObjectBlock($object, $morehtmlright='') + function showLinkedObjectBlock($object, $morehtmlright='',$compatibleImportElementsList=false) { global $conf,$langs,$hookmanager; global $bc; @@ -5996,7 +6000,9 @@ class Form // Bypass the default method $hookmanager->initHooks(array('commonobject')); - $parameters=array(); + $parameters=array( + 'compatibleImportElementsList' =>& $compatibleImportElementsList, + ); $reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook)) @@ -6008,7 +6014,7 @@ class Form print '
'; - print '
'; + print ''; + print ''; + print '
'; - else $out .= ''; - - $out .= $labeltoshow; - - if (empty($onetrtd)) $out .= ''.$labeltoshow.''; switch($mode) { case "view": @@ -6030,8 +6050,9 @@ abstract class CommonObject } $out .= '
'; + print '
'; print ''; print ''; @@ -6025,7 +6031,13 @@ class Form foreach($object->linkedObjects as $objecttype => $objects) { $tplpath = $element = $subelement = $objecttype; - + + // to display inport button on tpl + $showImportButton=false; + if(!empty($compatibleImportElementsList) && in_array($element,$compatibleImportElementsList)){ + $showImportButton=true; + } + if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs)) { $element = $regs[1]; @@ -6085,7 +6097,7 @@ class Form global $noMoreLinkedObjectBlockAfter; $noMoreLinkedObjectBlockAfter=1; } - + $res=@include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); if ($res) { @@ -6101,6 +6113,13 @@ class Form } print '
'.$langs->trans("Type").'
'; + + if(!empty($compatibleImportElementsList)) + { + $res=@include dol_buildpath('core/tpl/ajax/objectlinked_lineimport.tpl.php'); + } + + print '
'; return $nbofdifferenttypes; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index f516d142670..1f2fb48f4cc 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -835,6 +835,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $form = new Form($db); + $optioncss = GETPOST('optioncss', 'alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST('page','int'); @@ -886,7 +887,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') { if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); } - + $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // Purge search criteria if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers @@ -933,9 +934,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print "\n".''."\n"; - $param="socid=".$object->id; - if ($search_status != '') $param.='&search_status='.$search_status; - if ($search_name != '') $param.='&search_name='.urlencode($search_name); + $param="socid=".urlencode($object->id); + if ($search_status != '') $param.='&search_status='.urlencode($search_status); + if ($search_name != '') $param.='&search_name='.urlencode($search_name); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,"; $sql .= " t.civility as civility_id, t.address, t.zip, t.town"; @@ -943,7 +947,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)"; $sql .= " WHERE t.fk_soc = ".$object->id; if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status); - if ($search_name) $sql .= " AND (t.lastname LIKE '%".$db->escape($search_name)."%' OR t.firstname LIKE '%".$db->escape($search_name)."%')"; + if ($search_name) $sql .= natural_search(array('t.lastname', 't.firstname'), $search_name); + // Add where from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; if ($sortfield == "t.name") $sql.=" ORDER BY t.lastname $sortorder, t.firstname $sortorder"; else $sql.= " ORDER BY $sortfield $sortorder"; @@ -1107,7 +1113,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') // Edit if ($user->rights->societe->contact->creer) { - print ''; + print ''; print img_edit(); print ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dc9d179bb59..14f147d7f48 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3059,7 +3059,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') - * @param int $pictoisfullpath If 1, image path is a full path + * @param boolean|int $pictoisfullpath If true or 1, image path is a full path * @param int $srconly Return only content of the src attribute of img. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @param string $alt Force alt for bind peoplae @@ -3071,68 +3071,124 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ { global $conf, $langs; + // We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto + $url = DOL_URL_ROOT; + $theme = $conf->theme; + $path = 'theme/'.$theme; + // Define fullpathpicto to use into src - if ($pictoisfullpath) - { + if ($pictoisfullpath) { // Clean parameters - if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png'; + if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) { + $picto .= '.png'; + } $fullpathpicto = $picto; } - else - { + else { $pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto); //if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on'))) - if (in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow'))) - { - $fakey = $pictowithoutext; $facolor=''; $fasize=''; - if ($pictowithoutext == 'switch_off') { $fakey = 'fa-toggle-off'; $facolor='#999'; $fasize='2em'; } - elseif ($pictowithoutext == 'switch_on') { $fakey = 'fa-toggle-on'; $facolor='#227722'; $fasize='2em'; } - elseif ($pictowithoutext == 'off') { $fakey = 'fa-square-o'; $fasize='1.3em'; } - elseif ($pictowithoutext == 'on') { $fakey = 'fa-check-square-o'; $fasize='1.3em'; } - elseif ($pictowithoutext == 'bank') { $fakey = 'fa-bank'; $facolor='#444'; } - elseif ($pictowithoutext == 'delete') { $fakey = 'fa-trash'; $facolor='#444'; } - elseif ($pictowithoutext == 'edit') { $fakey = 'fa-pencil'; $facolor='#444'; } - elseif ($pictowithoutext == 'printer') { $fakey = 'fa-print'; $fasize='1.2em'; $facolor='#444'; } - elseif ($pictowithoutext == 'resize') { $fakey = 'fa-crop'; $facolor='#444'; } - elseif ($pictowithoutext == 'uparrow') { $fakey = 'fa-mail-forward'; $facolor='#555'; } - elseif ($pictowithoutext == 'unlink') { $fakey = 'fa-chain-broken'; $facolor='#555'; } - elseif ($pictowithoutext == 'playdisabled') { $fakey = 'fa-play'; $facolor='#ccc'; } - else { $fakey = 'fa-'.$pictowithoutext; $facolor='#444'; } + if (empty($srconly) && in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow'))) { + $fakey = $pictowithoutext; + $facolor = ''; + $fasize = ''; + if ($pictowithoutext == 'switch_off') { + $fakey = 'fa-toggle-off'; + $facolor = '#999'; + $fasize = '2em'; + } + elseif ($pictowithoutext == 'switch_on') { + $fakey = 'fa-toggle-on'; + $facolor = '#227722'; + $fasize = '2em'; + } + elseif ($pictowithoutext == 'off') { + $fakey = 'fa-square-o'; + $fasize = '1.3em'; + } + elseif ($pictowithoutext == 'on') { + $fakey = 'fa-check-square-o'; + $fasize = '1.3em'; + } + elseif ($pictowithoutext == 'bank') { + $fakey = 'fa-bank'; + $facolor = '#444'; + } + elseif ($pictowithoutext == 'delete') { + $fakey = 'fa-trash'; + $facolor = '#444'; + } + elseif ($pictowithoutext == 'edit') { + $fakey = 'fa-pencil'; + $facolor = '#444'; + } + elseif ($pictowithoutext == 'printer') { + $fakey = 'fa-print'; + $fasize = '1.2em'; + $facolor = '#444'; + } + elseif ($pictowithoutext == 'resize') { + $fakey = 'fa-crop'; + $facolor = '#444'; + } + elseif ($pictowithoutext == 'uparrow') { + $fakey = 'fa-mail-forward'; + $facolor = '#555'; + } + elseif ($pictowithoutext == 'unlink') { + $fakey = 'fa-chain-broken'; + $facolor = '#555'; + } + elseif ($pictowithoutext == 'playdisabled') { + $fakey = 'fa-play'; + $facolor = '#ccc'; + } + else { + $fakey = 'fa-'.$pictowithoutext; + $facolor = '#444'; + } - if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { $morecss.=($morecss?' ':'').$reg[1]; } - $enabledisablehtml =''; - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$titlealt; - $enabledisablehtml.=''; + if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { + $morecss.= ($morecss?' ':'').$reg[1]; + } + $enabledisablehtml = ''; + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $enabledisablehtml.= $titlealt; + } + $enabledisablehtml.= ''; return $enabledisablehtml; } - // We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto - $url = DOL_URL_ROOT; - $theme = $conf->theme; - - $path = 'theme/'.$theme; - if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module - else if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme - else if (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module + if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) { + $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module + } + else if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { + $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme + } + else if (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) { + $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module + } // If we ask an image into $url/$mymodule/img (instead of default path) - if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs)) - { + if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs)) { $picto = $regs[1]; $path = $regs[2]; // $path is $mymodule } // Clean parameters - if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png'; + if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) { + $picto .= '.png'; + } // If alt path are defined, define url where img file is, according to physical path - foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...) - { - if ($type == 'main') continue; - if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded - { - $url=DOL_URL_ROOT.$conf->file->dol_url_root[$type]; + // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...) + foreach ($conf->file->dol_document_root as $type => $dirroot) { + if ($type == 'main') { + continue; + } + // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded + if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) { + $url = DOL_URL_ROOT.$conf->file->dol_url_root[$type]; break; } } @@ -3141,15 +3197,16 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $fullpathpicto = $url.'/'.$path.'/img/'.$picto; } - if ($srconly) return $fullpathpicto; - else - { + if ($srconly) { + return $fullpathpicto; + } + else { // tag title is used for tooltip on , tag alt can be used with very simple text on image for bind people //$tmparray=array(0=>$titlealt); //if (empty($notitle) && preg_match('/:[^\s0-9]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB //$title=$tmparray[0]; //$alt=empty($tmparray[1])?'':$tmparray[1]; - $title=$titlealt; + $title = $titlealt; return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup } } @@ -6466,27 +6523,30 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti // Clean parameters $order=strtolower($order); - $sizearray=count($array); - if (is_array($array) && $sizearray>0) + if (is_array($array)) { - $temp = array(); - foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index]; - - if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp); - else + $sizearray=count($array); + if ($sizearray>0) { - ($case_sensitive) ? natsort($temp) : natcasesort($temp); - if($order!='asc') $temp=array_reverse($temp,TRUE); + $temp = array(); + foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index]; + + if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp); + else + { + ($case_sensitive) ? natsort($temp) : natcasesort($temp); + if($order!='asc') $temp=array_reverse($temp,TRUE); + } + + $sorted = array(); + + foreach(array_keys($temp) as $key) + { + (is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key]; + } + + return $sorted; } - - $sorted = array(); - - foreach(array_keys($temp) as $key) - { - (is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key]; - } - - return $sorted; } return $array; } diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 5414eed0592..edc61fac4cf 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -318,7 +318,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 ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __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 ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Tools -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 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 ('', 'empty($user->socid)', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 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 ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 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 ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3911__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 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 ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3912__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/list.php?leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 6d9d78e656b..a7f21a554c4 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1439,8 +1439,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu */ if ($mainmenu == 'tools') { - $langs->load("mails"); - $newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates'); + if (empty($user->socid)) // limit to internal users + { + $langs->load("mails"); + $newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates'); + } if (! empty($conf->mailing->enabled)) { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 517cc9894f9..7fb9f76119b 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1313,6 +1313,7 @@ class DolibarrModules // Can not be abstract, because we need to insta { foreach ($this->cronjobs as $key => $value) { + $entity = isset($this->cronjobs[$key]['entity'])?$this->cronjobs[$key]['entity']:$conf->entity; $label = isset($this->cronjobs[$key]['label'])?$this->cronjobs[$key]['label']:''; $jobtype = isset($this->cronjobs[$key]['jobtype'])?$this->cronjobs[$key]['jobtype']:''; $class = isset($this->cronjobs[$key]['class'])?$this->cronjobs[$key]['class']:''; @@ -1334,7 +1335,7 @@ class DolibarrModules // Can not be abstract, because we need to insta if ($objectname) $sql.= " AND objectname = '".$this->db->escape($objectname)."'"; if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'"; if ($command) $sql.= " AND command = '".$this->db->escape($command)."'"; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity = ".$entity; // Must be exact entity $now=dol_now(); @@ -1371,7 +1372,7 @@ class DolibarrModules // Can not be abstract, because we need to insta if(is_int($unitfrequency)){ $sql.= "'".$this->db->escape($unitfrequency)."', "; } if(is_int($priority)) {$sql.= "'".$this->db->escape($priority)."', ";} if(is_int($status)){ $sql.= "'".$this->db->escape($status)."', "; } - $sql.= $conf->entity.","; + $sql.= $entity.","; $sql.= "'".$this->db->escape($test)."'"; $sql.= ")"; diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index c6b652e265e..504164cd431 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -179,7 +179,7 @@ class CommActionRapport @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); - + return 1; } } @@ -291,7 +291,9 @@ class CommActionRapport if ($code == 'AC_OTH_AUTO') $code='AC_AUTO'; } $pdf->SetXY(60,$y); - $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Action".$code)),32), 0, 'L', 0); + $labelactiontype = $outputlangs->transnoentitiesnoconv("Action".$code); + $labelactiontypeshort = $outputlangs->transnoentitiesnoconv("Action".$code.'Short'); + $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($labelactiontypeshort == "Action".$code.'Short' ? $labelactiontype : $labelactiontypeshort),32), 0, 'L', 0); $y2 = $pdf->GetY(); // Description of event diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index b148149910f..2ce3cf9d9f6 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -95,9 +95,9 @@ class modCron extends DolibarrModules // Cronjobs $this->cronjobs = array( - 0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true), - 1=>array('label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>in_array($db->type, array('mysql', 'mysqli'))), - // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) + 0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true), + 1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>in_array($db->type, array('mysql', 'mysqli'))), + // 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) ); // Permissions diff --git a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php new file mode 100644 index 00000000000..ad32f1b9aa8 --- /dev/null +++ b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php @@ -0,0 +1,106 @@ + + * + * 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 . + */ + +// Protection to avoid direct call of template +if (empty($conf) || ! is_object($conf)) +{ + print "Error, template page can't be called as URL"; + exit; +} + +?> + + + + + \ No newline at end of file diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 8fa73ed5709..bc191ce9d80 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -56,10 +56,17 @@ if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; +// add html5 elements +$domData = ' data-element="'.$line->element.'"'; +$domData .= ' data-id="'.$line->id.'"'; +$domData .= ' data-qty="'.$line->qty.'"'; +$domData .= ' data-product_type="'.$line->product_type.'"'; + + ?> -> + > global->MAIN_VIEW_LINE_NUMBER)) { ?> @@ -264,7 +271,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; statut == 0 && ($object_rights->creer)) { ?> + if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?> + + + diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 8c97bc4e2c8..707b75b95fe 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -614,6 +614,22 @@ else print $langs->trans($object->note); print ""; + if (! empty($conf->multicompany->enabled)) + { + print '"; + } + print '
info_bits & 2) == 2 || ! empty($disableedit)) { ?> @@ -304,6 +311,9 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
'; + print $langs->trans('Entity').""; + if (! $object->entity) + { + print $langs->trans("AllEntities"); + } + else + { + $mc->getInfo($obj->entity); + print $mc->label; + } + print "
'; print '
'; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index be5ffbe965d..aeb0d7229b4 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -34,6 +34,7 @@ class Cronjob extends CommonObject public $table_element='cronjob'; //!< Name of table without prefix where object is stored public $picto = 'cron'; + public $entity; public $jobtype; public $tms=''; public $datec=''; @@ -158,7 +159,7 @@ class Cronjob extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob("; - + $sql.= "entity,"; $sql.= "datec,"; $sql.= "jobtype,"; $sql.= "label,"; @@ -188,6 +189,7 @@ class Cronjob extends CommonObject $sql.= "libname,"; $sql.= "test"; $sql.= ") VALUES ("; + $sql.= " ".(! isset($this->entity)?$conf->entity:$this->db->escape($this->entity)).","; $sql.= " '".$this->db->idate($now)."',"; $sql.= " ".(! isset($this->jobtype)?'NULL':"'".$this->db->escape($this->jobtype)."'").","; $sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").","; @@ -270,8 +272,8 @@ class Cronjob extends CommonObject function fetch($id) { $sql = "SELECT"; - $sql.= " t.rowid,"; - + $sql.= " t.rowid,"; + $sql.= " t.entity,"; $sql.= " t.tms,"; $sql.= " t.datec,"; $sql.= " t.jobtype,"; @@ -315,7 +317,7 @@ class Cronjob extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; - + $this->entity = $obj->entity; $this->tms = $this->db->jdate($obj->tms); $this->datec = $this->db->jdate($obj->datec); $this->label = $obj->label; @@ -422,7 +424,7 @@ class Cronjob extends CommonObject } } - $sql.= " ORDER BY $sortfield $sortorder "; + $sql.= $this->db->order($sortfield,$sortorder); if (!empty($limit) && !empty($offset)) { $sql.= $this->db->plimit($limit + 1,$offset); } @@ -450,7 +452,6 @@ class Cronjob extends CommonObject $line->id = $obj->rowid; $line->ref = $obj->rowid; - $line->entity = $obj->entity; $line->tms = $this->db->jdate($obj->tms); $line->datec = $this->db->jdate($obj->datec); @@ -580,7 +581,7 @@ class Cronjob extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."cronjob SET"; - + $sql.= " entity=".(isset($this->entity)?$this->db->escape($this->entity):$conf->entity).","; $sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").","; $sql.= " jobtype=".(isset($this->jobtype)?"'".$this->db->escape($this->jobtype)."'":"null").","; $sql.= " command=".(isset($this->command)?"'".$this->db->escape($this->command)."'":"null").","; @@ -778,7 +779,7 @@ class Cronjob extends CommonObject { $this->id=0; $this->ref=0; - + $this->entity=0; $this->tms=''; $this->datec=''; $this->label=''; @@ -935,6 +936,16 @@ class Cronjob extends CommonObject return -1; } + // Force the environment of running to the environment declared for job, so jobs launched from command line will run into correct environment + // When job is ran from GUI, the environment should already be same, except if job has entity 0 (visible into all environments) + if ($conf->entity != $this->entity && $this->entity > 0) + { + dol_syslog("We try to run a job in entity ".$this->entity." when we are in entity ".$conf->entity, LOG_WARNING); + } + $savcurrententity = $conf->entity; + $conf->entity = $this->entity; + dol_syslog(get_class($this)."::run_jobs entity for running job is ".$conf->entity); + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $user=new User($this->db); $result=$user->fetch('',$userlogin); @@ -942,6 +953,7 @@ class Cronjob extends CommonObject { $this->error="User Error:".$user->error; dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); + $conf->entity = $savcurrententity; return -1; } else @@ -950,6 +962,7 @@ class Cronjob extends CommonObject { $this->error=" User user login:".$userlogin." do not exists"; dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); + $conf->entity = $savcurrententity; return -1; } } @@ -981,6 +994,7 @@ class Cronjob extends CommonObject $result = $this->update($user); // This include begin/commit if ($result<0) { dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); + $conf->entity = $savcurrententity; return -1; } @@ -1079,6 +1093,7 @@ class Cronjob extends CommonObject { $this->error = $langs->trans('CronCannotLoadLib') . ': ' . $libpath; dol_syslog(get_class($this) . "::run_jobs " . $this->error, LOG_ERR); + $conf->entity = $savcurrententity; return -1; } // Load langs @@ -1086,6 +1101,7 @@ class Cronjob extends CommonObject if ($result<0) { dol_syslog(get_class($this) . "::run_jobs Cannot load module langs" . $langs->error, LOG_ERR); + $conf->entity = $savcurrententity; return -1; } dol_syslog(get_class($this) . "::run_jobs " . $this->libname . "::" . $this->methodename."(" . $this->params . ");", LOG_DEBUG); @@ -1148,13 +1164,12 @@ class Cronjob extends CommonObject if ($result < 0) { dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); + $conf->entity = $savcurrententity; return -1; } - else - { - return $error?-1:1; - } + $conf->entity = $savcurrententity; + return $error?-1:1; } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index b4df819b976..7bca10ff883 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -245,7 +245,7 @@ $sql.= " t.nbrun,"; $sql.= " t.libname,"; $sql.= " t.test"; $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t"; -$sql.= " WHERE 1 = 1"; +$sql.= " WHERE entity IN (0,".$conf->entity.")"; if ($search_status >= 0 && $search_status < 2) $sql.= " AND t.status = ".(empty($search_status)?'0':'1'); if ($search_status == 2) $sql.= " AND t.status = 2"; //Manage filter diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 46692c9025b..9c5aec63951 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -131,7 +131,9 @@ if ($resql) //if ($page > 0) $param.= '&page='.$page; if ($optioncss != '') $param.='&optioncss='.$optioncss; - print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords); + $newcardbutton=''.$langs->trans('NewDonation').''; + + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords, 'title_generic.png', 0, $newcardbutton); print ''."\n"; if ($optioncss != '') print ''; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index dd6fa84ec4b..88050097d3f 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -148,12 +148,13 @@ if (empty($reshook)) { // Mass actions. Controls on number of lines checked $maxformassaction=1000; - if (! empty($massaction) && count($toselect) < 1) + $numtoselect = (is_array($toselect)?count($toselect):0); + if (! empty($massaction) && $numtoselect < 1) { $error++; setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); } - if (! $error && count($toselect) > $maxformassaction) + if (! $error && $numtoselect > $maxformassaction) { setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); $error++; @@ -264,6 +265,12 @@ if ($resql) //$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); + $newcardbutton=''; + if ($user->rights->expedition->creer) + { + $newcardbutton=''.$langs->trans('NewSending').''; + } + $i = 0; print ''."\n"; if ($optioncss != '') print ''; @@ -274,7 +281,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, '', '', $limit); + print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); if ($sall) { @@ -541,7 +548,7 @@ if ($resql) { $shipment->fetchObjectLinked($shipment->id,$shipment->element); $receiving=''; - if (count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']); + if (is_array($shipment->linkedObjects['delivery']) && count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']); if (! empty($arrayfields['l.ref']['checked'])) { diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 6fcc8e6494a..eea3545bb07 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2090,7 +2090,7 @@ else if (! empty($conf->projet->enabled)) { print ''; - $formproject->select_projects(-1, $line->fk_projet,'fk_projet', 0, 0, 1, 1); + $formproject->select_projects(-1, $line->fk_projet,'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print ''; } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index c3a6b2341f1..57b3f9b34c8 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1241,7 +1241,7 @@ class ExpenseReport extends CommonObject $error = 0; // date approval - $this->date_approve = $this->db->idate($now); + $this->date_approve = $now; if ($this->fk_statut != 5) { $this->db->begin(); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index b32bf62f394..e358e69e453 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -465,7 +465,14 @@ if ($resql) else { $title = $langs->trans("ListTripsAndExpenses"); - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); + + $newcardbutton=''; + if ($user->rights->expensereport->creer) + { + $newcardbutton=''.$langs->trans('NewTrip').''; + } + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); } $topicmail="SendExpenseReport"; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index f0028e0760a..f7082770970 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -271,6 +271,12 @@ if ($resql) if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + $newcardbutton=''; + if ($user->rights->ficheinter->creer) + { + $newcardbutton=''.$langs->trans('NewIntervention').''; + } + // Lines of title fields print ''."\n"; if ($optioncss != '') print ''; @@ -282,7 +288,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit); $topicmail="Information"; $modelmail="intervention"; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index cca33fb4862..1fe8d82fa87 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -645,6 +645,12 @@ if ($resql) if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + $newcardbutton=''; + if($user->rights->fournisseur->commande->creer) + { + $newcardbutton=''.$langs->trans('NewOrder').''; + } // Lignes des champs de filtre print ''; @@ -657,8 +663,7 @@ if ($resql) print ''; print ''; print ''; - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit); $topicmail="SendOrderRef"; $modelmail="order_supplier_send"; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 2255722eed7..d3fdcdcba01 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -471,6 +471,12 @@ if ($resql) if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + $newcardbutton=''; + if ($user->rights->fournisseur->facture->creer) + { + $newcardbutton=''.$langs->trans('NewBill').''; + } + $i = 0; print ''."\n"; if ($optioncss != '') print ''; @@ -483,7 +489,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); $topicmail="SendBillRef"; $modelmail="supplier_invoice_send"; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 03f4108e02e..e00c182f949 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -377,7 +377,10 @@ else $nbtotalofrecords = count($holiday->holiday); //print $num; //print count($holiday->holiday); - print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, '', '', $limit); + + $newcardbutton=''.$langs->trans('MenuAddCP').''; + + print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, $newcardbutton, '', $limit); $topicmail="Information"; $modelmail="leaverequest"; diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index f585ef8653f..9047ab050d3 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -41,6 +41,11 @@ DROP TABLE llx_c_accountingaccount; update llx_propal set fk_statut = 1 where fk_statut = -1; +ALTER TABLE llx_inventory ADD COLUMN fk_user_creat integer; +ALTER TABLE llx_inventory ADD COLUMN fk_user_modif integer; +ALTER TABLE llx_inventory ADD COLUMN fk_user_valid integer; +ALTER TABLE llx_inventory ADD COLUMN import_key varchar(14); + -- For 8.0 diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index be46a1e15c8..655e5d46884 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1729,6 +1729,7 @@ MailToSendContract=To send a contract MailToThirdparty=To send email from third party page MailToMember=To send email from member page MailToUser=To send email from user page +MailToProject= To send email from project page ByDefaultInList=Show by default on list view YouUseLastStableVersion=You use the latest stable version TitleExampleForMajorRelease=Example of message you can use to announce this major release (feel free to use it on your web sites) diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 83f2b96c839..25e2849b949 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -103,6 +103,7 @@ LT2PaymentsES=IRPF Payments VATPayment=Sales tax payment VATPayments=Sales tax payments VATRefund=Sales tax refund +NewVATPayment=New sales tax payment Refund=Refund SocialContributionsPayments=Social/fiscal taxes payments ShowVatPayment=Show VAT payment diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 3c512ca7286..e38b038cfee 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -78,6 +78,7 @@ ResultOfMailSending=Result of mass EMail sending NbSelected=Nb selected NbIgnored=Nb ignored NbSent=Nb sent +SentXXXmessages=%s message(s) sent. ConfirmUnvalidateEmailing=Are you sure you want to change email %s to draft status? MailingModuleDescContactsWithThirdpartyFilter=Contact with customer filters MailingModuleDescContactsByCompanyCategory=Contacts by third party category diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 066f761bb32..2afabe43b06 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -246,3 +246,4 @@ WEBSITE_PAGEURL=URL of page WEBSITE_TITLE=Title WEBSITE_DESCRIPTION=Description WEBSITE_KEYWORDS=Keywords +LinesToImport=Lines to import diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 4e1f755894b..5cc94c39309 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -226,3 +226,4 @@ AllowCommentOnProject=Allow user comments on projects DontHavePermissionForCloseProject=You do not have permissions to close the project %s DontHaveTheValidateStatus=The project %s must be open to be closed RecordsClosed=%s project(s) closed +SendProjectRef=About project %s diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index d1436287db3..24ea1ab72f9 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -111,6 +111,12 @@ if ($resql) if ($search_amount) $param.="&search_amount=".urlencode($search_amount_ht); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + $newcardbutton=''; + if ($user->rights->loan->write) + { + $newcardbutton=''.$langs->trans('NewLoan').''; + } + print ''."\n"; if ($optioncss != '') print ''; print ''; @@ -120,7 +126,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); + print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit); print '
'; print ''."\n"; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 4d1eb6829bd..7a4a04286f9 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -211,7 +211,8 @@ foreach($object->fields as $key => $val) $sql.='t.'.$key.', '; } // Add fields from extrafields -foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +if (! empty($extrafields->attributes[$object->element]['label'])) + foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -242,7 +243,8 @@ foreach($object->fields as $key => $val) $sql.='t.'.$key.', '; } // Add fields from extrafields -foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : ''); +if (! empty($extrafields->attributes[$object->element]['label'])) { + foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : ''); // Add where from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index a2bf0b106ed..051028c8f19 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -79,7 +79,13 @@ llxHeader('', $langs->trans("OpenSurveyArea")); $param=''; $fieldtosortuser=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?'firstname':'lastname'; -print load_fiche_titre($langs->trans("OpenSurveyArea")); +$newcardbutton=''; +if ($user->rights->opensurvey->read) +{ + $newcardbutton=''.$langs->trans('NewSurvey').''; +} + +print_barre_liste($langs->trans("OpenSurveyArea"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton); // List of surveys into database diff --git a/htdocs/product/card.php b/htdocs/product/card.php index a2794801fae..1543dec699d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -77,6 +77,7 @@ $duration_unit = GETPOST('duration_unit'); if (! empty($user->societe_id)) $socid=$user->societe_id; $object = new Product($db); +$object->type = $type; // so test later to fill $usercancxxx is correct $extrafields = new ExtraFields($db); // fetch optionals attributes and labels diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index a24ca1c8808..95670698380 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -185,7 +185,9 @@ foreach($object->fields as $key => $val) $sql.='t.'.$key.', '; } // Add fields from extrafields -foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +if (! empty($extrafields->attributes[$object->element]['label'])) { + foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +} // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -409,12 +411,13 @@ print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine=0; -foreach ($extrafields->attributes[$object->element]['computed'] as $key => $val) -{ - if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object +if (! empty($extrafields->attributes[$object->element]['computed'])) { + foreach ($extrafields->attributes[$object->element]['computed'] as $key => $val) + { + if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object + } } - // Loop on record // -------------------------------------------------------------------- $i=0; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index c6a7835158d..503fc6069cc 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -278,7 +278,9 @@ else $sql .= ', pac.rowid prod_comb_id'; } // Add fields from extrafields - foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); + if (! empty($extrafields->attributes[$object->element]['label'])) { + foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); + } // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook @@ -335,7 +337,9 @@ else $sql .= ', pac.rowid'; } // Add fields from extrafields - foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : ''); + if (! empty($extrafields->attributes[$object->element]['label'])) { + foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : ''); + } // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook @@ -416,6 +420,16 @@ else if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + $newcardbutton=''; + $rightskey='produit'; + if($type == Product::TYPE_SERVICE) $rightskey='service'; + if($user->rights->{$rightskey}->creer) + { + $label='NewProduct'; + if($type == Product::TYPE_SERVICE) $label='NewService'; + $newcardbutton=''.$langs->trans($label).''; + } + print ''; if ($optioncss != '') print ''; print ''; @@ -427,7 +441,7 @@ else print ''; if (empty($arrayfields['p.fk_product_type']['checked'])) print ''; - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, '', '', $limit); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, $newcardbutton, '', $limit); $topicmail="Information"; $modelmail="product"; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 58ea5eadc21..29e5439b8e8 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -43,7 +43,7 @@ $sortorder = GETPOST("sortorder"); if (! $sortfield) $sortfield="e.ref"; if (! $sortorder) $sortorder="ASC"; $page = GETPOST("page"); -if ($page < 0) $page = 0; +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $year = strftime("%Y",time()); @@ -130,6 +130,12 @@ if ($result) if ($search_status) $param.="&search_status=".urlencode($search_status); if ($sall) $param.="&sall=".urlencode($sall); + $newcardbutton=''; + if ($user->rights->stock->creer) + { + $newcardbutton=''.$langs->trans('MenuNewWarehouse').''; + } + print ''; print ''; print ''; @@ -137,7 +143,7 @@ if ($result) print ''; print ''; - print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_generic.png', 0, '', '', $limit); + print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_generic.png', 0, $newcardbutton, '', $limit); if ($sall) { diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index caea260118f..ebe1fbe5375 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -55,6 +55,7 @@ $idline = GETPOST('idline'); $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 if (!$sortfield) { $sortfield = 'p.ref'; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 0bed4022eb3..6093a252cb6 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -72,7 +72,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -if ($page < 0) $page = 0; +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; if (! $sortfield) $sortfield="m.datem"; if (! $sortorder) $sortorder="DESC"; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index c5cfb9b3756..466bb8729c2 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -446,6 +446,13 @@ if (empty($reshook)) $comefromclone=true; } } + + // Actions to send emails + $trigger_name='PROJECT_SENTBYMAIL'; + $paramname='id'; + $autocopy='MAIN_MAIL_AUTOCOPY_ORDER_TO'; // used to know the automatic BCC to add + $trackid='proj'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -1064,7 +1071,7 @@ elseif ($object->id > 0) // modified by hook if (empty($reshook)) { - if ($action != "edit" ) + if ($action != "edit" && $action != 'presend' ) { // Create event @@ -1075,6 +1082,12 @@ elseif ($object->id > 0) print ''; }*/ + // Send + if ($object->statut != 2) + { + print ''; + } + // Modify if ($object->statut != 2 && $user->rights->projet->creer) { @@ -1212,6 +1225,10 @@ elseif ($object->id > 0) print ""; + if (GETPOST('modelselected')) { + $action = 'presend'; + } + if ($action != 'presend') { print '
'; @@ -1244,6 +1261,14 @@ elseif ($object->id > 0) print '
'; } + // Presend form + $modelmail='project'; + $defaulttopic='SendProjectRef'; + $diroutput = $conf->projet->dir_output; + $trackid = 'proj'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; + // Hook to add more things on page $parameters=array(); $reshook=$hookmanager->executeHooks('mainCardTabAddMore',$parameters,$object,$action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 3da1d4fe566..e57eab2d109 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -438,6 +438,12 @@ if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=arr $massactionbutton=$form->selectMassAction('', $arrayofmassactions); +$newcardbutton=''; +if ($user->rights->projet->creer) +{ + $newcardbutton = ''.$langs->trans('NewProject').''; +} + print ''; if ($optioncss != '') print ''; print ''; @@ -449,7 +455,7 @@ print ''; print ''; print ''; -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, $newcardbutton, '', $limit); // Show description of content print '
'; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index a31ec6f57d4..9e14c462bef 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -390,6 +390,12 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs-> if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); +$newcardbutton=''; +if ($user->rights->projet->creer) +{ + $newcardbutton = ''.$langs->trans('NewTask').''; +} + print ''; if ($optioncss != '') print ''; print ''; @@ -401,7 +407,7 @@ print ''; print ''; print ''; -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, $newcardbutton, '', $limit); // Show description of content print '
'; diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 72c7945bf43..927975e9c26 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -196,7 +196,13 @@ if($ret == -1) { dol_print_error($db,$object->error); exit; } else { - print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $nbtotalofrecords,'title_generic.png', 0, '', '', $limit); + $newcardbutton=''; + if ($user->rights->resource->write) + { + $newcardbutton=''.$langs->trans('MenuResourceAdd').''; + } + + print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $nbtotalofrecords,'title_generic.png', 0, $newcardbutton, '', $limit); } $moreforfilter = ''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 920dee364c7..663a1b80586 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1643,6 +1643,7 @@ else print ''; print ''; print ''; + print ''; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bb9748b1af3..511273fe4c6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -772,9 +772,10 @@ class Societe extends CommonObject // Clean parameters $this->id = $id; + $this->entity = ((isset($this->entity) && is_numeric($this->entity))?$this->entity:$conf->entity); $this->name = $this->name?trim($this->name):trim($this->nom); $this->nom = $this->name; // For backward compatibility - $this->name_alias = trim($this->name_alias); + $this->name_alias = trim($this->name_alias); $this->ref_ext = trim($this->ref_ext); $this->address = $this->address?trim($this->address):trim($this->address); $this->zip = $this->zip?trim($this->zip):trim($this->zip); @@ -789,9 +790,9 @@ class Societe extends CommonObject $this->fax = preg_replace("/\./","",$this->fax); $this->email = trim($this->email); $this->skype = trim($this->skype); - $this->url = $this->url?clean_url($this->url,0):''; - $this->note_private = trim($this->note_private); - $this->note_public = trim($this->note_public); + $this->url = $this->url?clean_url($this->url,0):''; + $this->note_private = trim($this->note_private); + $this->note_public = trim($this->note_public); $this->idprof1 = trim($this->idprof1); $this->idprof2 = trim($this->idprof2); $this->idprof3 = trim($this->idprof3); @@ -896,7 +897,8 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::update verify ok or not done"); $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET "; - $sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required + $sql .= "entity = " . $this->entity; + $sql .= ",nom = '" . $this->db->escape($this->name) ."'"; // Required $sql .= ",name_alias = '" . $this->db->escape($this->name_alias) ."'"; $sql .= ",ref_ext = " .(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext) ."'":"null"); $sql .= ",address = '" . $this->db->escape($this->address) ."'"; @@ -2694,21 +2696,16 @@ class Societe extends CommonObject if (! empty($conf->global->SOCIETE_CODECOMPTA_ADDON)) { - $file=''; + $res=false; $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - if (file_exists(DOL_DOCUMENT_ROOT.'/'.$dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.".php")) - { - $file=$dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.".php"; - break; - } + $res=dol_include_once($dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.'.php'); + if ($res) break; } - if (! empty($file)) + if ($res) { - dol_include_once($file); - $classname = $conf->global->SOCIETE_CODECOMPTA_ADDON; $mod = new $classname; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 460a0143c05..448f526df4a 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -569,6 +569,23 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs-> if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); +$newcardbutton=''; +if ($user->rights->societe->creer) +{ + $typefilter=''; + $label='MenuNewThirdParty'; + + if(! empty($type)) + { + $typefilter = '&type='.$type; + if($type == 'p') $label='MenuNewProspect'; + if($type == 'c') $label='MenuNewCustomer'; + if($type == 'f') $label='NewSupplier'; + } + + $newcardbutton = ''.$langs->trans($label).''; +} + print ''; if ($optioncss != '') print ''; print ''; @@ -577,7 +594,7 @@ print ''; print ''; print ''; -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); $langs->load("other"); $textprofid=array(); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 2f676f9d6fa..09cbd063e64 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -386,6 +386,12 @@ if ($resql) if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + $newcardbutton=''; + if($user->rights->supplier_proposal->creer) + { + $newcardbutton=''.$langs->trans('NewAskPrice').''; + } + // Lignes des champs de filtre print ''; if ($optioncss != '') print ''; @@ -396,7 +402,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit); $topicmail="SendSupplierProposalRef"; $modelmail="supplier_proposal_send"; diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 46ca99d3727..c39dbaafc97 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -69,7 +69,7 @@ if (($object->id != $user->id) && (! $user->rights->user->user->lire)) accessforbidden(); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('usercard','useragenda','globalcard'); +$hookmanager->initHooks(array('usercard','useragenda','globalcard')); /* * Actions diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3d63c308729..db17f7eaab5 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot * Copyright (C) 2012 Juanjo Menent @@ -102,7 +102,7 @@ $extrafields = new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager->initHooks(array('usercard','globalcard'); +$hookmanager->initHooks(array('usercard','globalcard')); @@ -203,7 +203,7 @@ if (empty($reshook)) { $object->office_fax = GETPOST("office_fax", 'alpha'); $object->user_mobile = GETPOST("user_mobile"); $object->skype = GETPOST("skype", 'alpha'); - $object->email = GETPOST("email", 'alpha'); + $object->email = preg_replace('/\s+/', '', GETPOST("email", 'alpha')); $object->job = GETPOST("job", 'alpha'); $object->signature = GETPOST("signature"); $object->accountancy_code = GETPOST("accountancy_code"); @@ -347,7 +347,7 @@ if (empty($reshook)) { $object->office_fax = GETPOST("office_fax", 'alpha'); $object->user_mobile = GETPOST("user_mobile"); $object->skype = GETPOST("skype", 'alpha'); - $object->email = GETPOST("email", 'alpha'); + $object->email = preg_replace('/\s+/', '', GETPOST("email", 'alpha')); $object->job = GETPOST("job", 'alpha'); $object->signature = GETPOST("signature"); $object->accountancy_code = GETPOST("accountancy_code"); diff --git a/htdocs/user/document.php b/htdocs/user/document.php index d77b30a4721..b8fc923acae 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref)) } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('usercard','userdoc','globalcard'); +$hookmanager->initHooks(array('usercard','userdoc','globalcard')); /* diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 27170062198..fd33d4d5427 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -60,7 +60,7 @@ $object->fetch($id); $entity=$conf->entity; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks('groupperms','globalcard'); +$hookmanager->initHooks(array('groupperms','globalcard')); /** diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 42f7a736b91..246fd3d75b4 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -85,7 +85,7 @@ if ($key != $conf->global->CRON_KEY) // If param userlogin is reserved word 'firstadmin' if ($userlogin == 'firstadmin') { - $sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 and statut = 1 ORDER BY entity LIMIT 1'; + $sql='SELECT login, entity from '.MAIN_DB_PREFIX.'user WHERE admin = 1 and statut = 1 ORDER BY entity LIMIT 1'; $resql=$db->query($sql); if ($resql) { @@ -93,7 +93,7 @@ if ($userlogin == 'firstadmin') if ($obj) { $userlogin = $obj->login; - echo "First admin user found is login '".$userlogin."'\n"; + echo "First admin user found is login '".$userlogin."', entity ".$obj->entity."\n"; } } else dol_print_error($db); @@ -132,7 +132,7 @@ if (! empty($id)) { $filter['t.rowid']=$id; } -$result = $object->fetch_all('DESC','t.rowid', 0, 0, 1, $filter, 0); +$result = $object->fetch_all('ASC,ASC,ASC','t.priority,t.entity,t.rowid', 0, 0, 1, $filter, 0); if ($result<0) { echo "Error: ".$object->error; @@ -159,8 +159,8 @@ if(is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) // Loop over job foreach($qualifiedjobs as $line) { - dol_syslog("cron_run_jobs.php cronjobid: ".$line->id, LOG_DEBUG); - echo "cron_run_jobs.php cronjobid: ".$line->id."\n"; + dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG); + echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label."\n"; //If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index eb84f6cd348..da6fe60d787 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -465,6 +465,10 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $after=dol_string_nohtmltag($text,1); $this->assertEquals("DEF",$after,"test7"); + $text='HIJ'; + $after=dol_string_nohtmltag($text,0); + $this->assertEquals("HIJ",$after,"test8"); + return true; } @@ -816,13 +820,18 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $this->assertContains('theme',$s,'testImgPicto2'); $this->assertContains('style="float: right"',$s,'testImgPicto2'); - $s=img_picto('title','/fullpath/img.png','',1); + $s=img_picto('title', '/fullpath/img.png', '', 1); print __METHOD__." s=".$s."\n"; $this->assertEquals('',$s,'testImgPicto3'); - $s=img_picto('title','/fullpath/img.png','',true); + $s=img_picto('title', '/fullpath/img.png', '', true); print __METHOD__." s=".$s."\n"; $this->assertEquals('',$s,'testImgPicto4'); + + $s=img_picto('title', 'delete', '', 0, 1); + print __METHOD__." s=".$s."\n"; + $this->assertEquals('',$s,'testImgPicto3'); + } /**