diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 86c5f717f4b67..70988d7e330fb 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -91,6 +91,13 @@ function societe_prepare_head(Societe $object) $head[$h][2] = 'agenda'; $h++; } + if (! empty($conf->projet->enabled) && (!empty($user->rights->projet->lire) )) + { + $head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id; + $head[$h][1] = $langs->trans("Projects"); + $head[$h][2] = 'project'; + $h++; + } //show categorie tab /*if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { @@ -456,9 +463,10 @@ function getFormeJuridiqueLabel($code) * @param DoliDB $db Database handler * @param Object $object Third party object * @param string $backtopage Url to go once contact is created + * @param int $nocreatelink 1=Hide create project link * @return void */ -function show_projects($conf,$langs,$db,$object,$backtopage='') +function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0) { global $user; global $bc; @@ -470,7 +478,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') $langs->load("projects"); $buttoncreate=''; - if (! empty($conf->projet->enabled) && $user->rights->projet->creer) + if (! empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink)) { //$buttoncreate=''.$langs->trans("AddProject").''; $buttoncreate=''.$langs->trans("AddProject"); @@ -864,13 +872,13 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='') /** * Show html area with actions to do * - * @param Conf $conf Object conf - * @param Translate $langs Object langs - * @param DoliDB $db Object db - * @param Adherent|Societe $object Object third party or member - * @param Contact $objcon Object contact - * @param int $noprint Return string but does not output it - * @return mixed Return html part or void if noprint is 1 + * @param Conf $conf Object conf + * @param Translate $langs Object langs + * @param DoliDB $db Object db + * @param Adherent|Societe $object Object third party or member + * @param Contact $objcon Object contact + * @param int $noprint Return string but does not output it + * @return mixed Return html part or void if noprint is 1 */ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) { diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index e5000d008f2d9..748f91dbefe8d 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -624,7 +624,7 @@ print ''.$langs->trans("Label").''; print ''; - // Customer + // Thirdparty print ''.$langs->trans("ThirdParty").''; $filteronlist=''; if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; @@ -713,7 +713,7 @@ // Third party print ''.$langs->trans("ThirdParty").''; - if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1, 'project'); else print' '; print ''; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index b35715ce1ab43..3d72ad9d32889 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -121,17 +121,34 @@ dol_fiche_end(); - /* + + + /* * Barre d'action */ - print '
'; + $objthirdparty=$object; + $objcon=new stdClass(); + + $out=''; + $permok=$user->rights->agenda->myactions->create; + if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) + { + //$out.='trans("AddAnAction"),'filenew'); + //$out.=""; + } + + print '
'; if (! empty($conf->agenda->enabled)) { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + print ''.$langs->trans("AddAction").''; } else { @@ -143,25 +160,11 @@ print '
'; - $objthirdparty=$object; - $objcon=new stdClass(); - - $out=''; - $permok=$user->rights->agenda->myactions->create; - if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) - { - $out.=''; - $out.=$langs->trans("AddAnAction").' '; - $out.=img_picto($langs->trans("AddAnAction"),'filenew'); - $out.=""; - } - print load_fiche_titre($langs->trans("ActionsOnCompany"),$out,''); + print load_fiche_titre($langs->trans("ActionsOnCompany"),'',''); // List of todo actions - show_actions_todo($conf,$langs,$db,$object); + show_actions_todo($conf,$langs,$db,$object,null,0,1); // List of done actions show_actions_done($conf,$langs,$db,$object); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 21de67bfcf71e..1f5f10c91784d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1747,12 +1747,12 @@ function del_commercial(User $user, $commid) * Return a link on thirdparty (with picto) * * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) - * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') + * @param string $option Target of link ('', 'customer', 'prospect', 'supplier', 'project') * @param int $maxlen Max length of name * @param integer $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$maxlen=0,$notooltip=0) + function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0) { global $conf,$langs; @@ -1795,6 +1795,16 @@ function getNomUrl($withpicto=0,$option='',$maxlen=0,$notooltip=0) $label.= '' . $langs->trans("ShowSupplier") . ''; $link = ''; + $link = ''; + $link = ''; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 291f81a6fe895..6a6fb7ab1df11 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -195,6 +195,8 @@ print "\n"; + print '
'; + // Add notification form print load_fiche_titre($langs->trans("AddNewNotification"),'',''); diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index e5f89779225cb..f739c0ac6faa5 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -429,107 +429,8 @@ } else { + // View mode - // View mode - - // Count total nb of records - $nbtotalofrecords = 0; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter); - } - - $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); - if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); - } - - $option = '&search_soc=' . $search_soc . '&id=' . $object->id; - - print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords); - - print '
'; - print ''; - - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - if (count($prodcustprice->lines) > 0) { - - print ''; - print ''; - print ''; - // Print the search button - print ''; - print ''; - - $var = False; - - foreach($prodcustprice->lines as $line) - { - print ""; - - $staticprod = new Product($db); - $staticprod->fetch($line->fk_product); - - print ""; - print ""; - - print '"; - print '"; - print '"; - print '"; - print ''; - print ''; - - // User - $userstatic = new User($db); - $userstatic->fetch($line->fk_user); - print ''; - - // Todo Edit or delete button - // Action - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; - } - - print "\n"; - } - } else { - print ''; - } - - print "
' . $langs->trans("Product") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
 '; - print ''; - print '
" . $staticprod->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; - print $userstatic->getLoginUrl(1); - print ''; - print 'id . '&prodid=' . $line->fk_product . '">'; - print img_info(); - print ''; - print ' '; - print 'id . '&lineid=' . $line->id . '">'; - print img_edit('default', 0, 'style="vertical-align: middle;"'); - print ''; - print ' '; - print 'id . '&lineid=' . $line->id . '">'; - print img_delete('default', 'style="vertical-align: middle;"'); - print ''; - print '
'.$langs->trans('NoPriceSpecificToCustomer').'
"; - - print "
"; - /* ************************************************************************** */ /* */ /* Barre d'action */ @@ -541,7 +442,112 @@ if ($user->rights->produit->creer || $user->rights->service->creer) { print '
'; } - print "\n

\n"; + print "\n
\n"; + + + // Count total nb of records + $nbtotalofrecords = 0; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter); + } + + $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); + if ($result < 0) + { + setEventMessage($prodcustprice->error, 'errors'); + } + + $option = '&search_soc=' . $search_soc . '&id=' . $object->id; + + print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, ''); + + print '
'; + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + if (count($prodcustprice->lines) > 0) + { + + print ''; + print ''; + print ''; + // Print the search button + print ''; + print ''; + + $var = False; + + foreach ($prodcustprice->lines as $line) + { + print ""; + + $staticprod = new Product($db); + $staticprod->fetch($line->fk_product); + + print ""; + print ""; + + print '"; + print '"; + print '"; + print '"; + print ''; + print ''; + + // User + $userstatic = new User($db); + $userstatic->fetch($line->fk_user); + print ''; + + // Todo Edit or delete button + // Action + if ($user->rights->produit->creer || $user->rights->service->creer) + { + print ''; + } + + print "\n"; + } + } else + { + print ''; + } + + print "
' . $langs->trans("Product") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
 '; + print ''; + print '
" . $staticprod->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; + print $userstatic->getLoginUrl(1); + print ''; + print 'id . '&prodid=' . $line->fk_product . '">'; + print img_info(); + print ''; + print ' '; + print 'id . '&lineid=' . $line->id . '">'; + print img_edit('default', 0, 'style="vertical-align: middle;"'); + print ''; + print ' '; + print 'id . '&lineid=' . $line->id . '">'; + print img_delete('default', 'style="vertical-align: middle;"'); + print ''; + print '
' . $langs->trans('NoPriceSpecificToCustomer') . '
"; + + print "
"; + } } diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php new file mode 100644 index 0000000000000..6eb9765d034c2 --- /dev/null +++ b/htdocs/societe/project.php @@ -0,0 +1,156 @@ + + * Copyright (C) 2005 Brice Davoleau + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2015 Marcos GarcĂ­a + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/societe/project.php + * \ingroup societe + * \brief Page of third party projects + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + +$langs->load("companies"); + +// Security check +$socid = GETPOST('socid','int'); +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'societe', $socid, '&societe'); + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('projectthirdparty')); + + +/* + * Actions + */ + +$parameters=array('id'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + + +/* + * View + */ + +$contactstatic = new Contact($db); + +$form = new Form($db); + +if ($socid) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $langs->load("companies"); + + + $object = new Societe($db); + $result = $object->fetch($socid); + + $title=$langs->trans("Agenda"); + if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; + llxHeader('',$title); + + if (! empty($conf->notification->enabled)) $langs->load("mails"); + $head = societe_prepare_head($object); + + dol_fiche_head($head, 'project', $langs->trans("ThirdParty"),0,'company'); + + dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + + print '
'; + + print '
'; + print ''; + + // Alias names (commercial, trademark or alias names) + print '"; + + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + { + print ''; + } + + if ($object->client) + { + print ''; + } + + if ($object->fournisseur) + { + print ''; + } + + print '
'.$langs->trans('AliasNames').''; + print $object->name_alias; + print "
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; + print $langs->trans('CustomerCode').''; + print $object->code_client; + if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + print '
'; + print $langs->trans('SupplierCode').''; + print $object->code_fournisseur; + if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + print '
'; + + print '
'; + + dol_fiche_end(); + + + /* + * Barre d'action + */ + + print '
'; + + if (! empty($conf->projet->enabled)) + { + if (! empty($conf->projet->enabled) && ! empty($user->rights->projet->creer)) + { + print ''.$langs->trans("AddProject").''; + } + else + { + print ''.$langs->trans("AddProject").''; + } + } + + print '
'; + + + print '
'; + + + // Projects list + $result=show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1); +} + + +llxFooter(); + +$db->close(); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 9fa6e117279aa..93fff61d1f1ee 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -2481,9 +2481,6 @@ { $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } - - // Projects list - $result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } }