diff --git a/htdocs/comm/clients.php b/htdocs/comm/clients.php index 4b57c8b41de..c84634ebaf2 100644 --- a/htdocs/comm/clients.php +++ b/htdocs/comm/clients.php @@ -139,7 +139,7 @@ if ($result) if ($user->rights->societe->client->voir || $socid) { $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; - $moreforfilter.=$htmlother->select_salesrepresentatives($search_sale,'search_sale'); + $moreforfilter.=$htmlother->select_salesrepresentatives($search_sale,'search_sale',$user); } if ($moreforfilter) { diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 345fabcc9e5..8eb4e26cd8d 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -24,8 +24,8 @@ /** * \file htdocs/comm/fiche.php - * \ingroup commercial - * \brief Onglet client de la fiche societe + * \ingroup commercial, compta + * \brief Page to show customer card of a third party * \version $Id$ */ @@ -39,9 +39,10 @@ if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/class/cont if (!empty($conf->global->MAIN_MODULE_CHRONODOCS)) require_once(DOL_DOCUMENT_ROOT."/chronodocs/chronodocs_entries.class.php"); $langs->load("companies"); -$langs->load("orders"); -$langs->load("bills"); -$langs->load("contracts"); +if ($conf->contrat->enabled) $langs->load("contracts"); +if ($conf->commande->enabled) $langs->load("orders"); +if ($conf->facture->enabled) $langs->load("bills"); +if ($conf->projet->enabled) $langs->load("projects"); if ($conf->ficheinter->enabled) $langs->load("interventions"); if ($conf->notification->enabled) $langs->load("mails"); if (!empty($conf->global->MAIN_MODULE_CHRONODOCS)) $langs->load("chronodocs"); @@ -61,6 +62,20 @@ if (! $sortfield) $sortfield="nom"; * Actions */ +if ($_POST['action'] == 'setcustomeraccountancycode') +{ + $societe = new Societe($db); + $result=$societe->fetch($_POST['socid']); + $societe->code_compta=$_POST["customeraccountancycode"]; + $result=$societe->update($societe->id,$user,1,1,0); + if ($result < 0) + { + $mesg=join(',',$societe->errors); + } + $POST["action"]=""; + $socid=$_POST["socid"]; +} + if ($_GET["action"] == 'attribute_prefix' && $user->rights->societe->creer) { $societe = new Societe($db, $_GET["socid"]); @@ -106,8 +121,9 @@ if ($_POST["action"] == 'setassujtva' && $user->rights->societe->creer) llxHeader('',$langs->trans('CustomerCard')); +$facturestatic=new Facture($db); +$contactstatic = new Contact($db); $userstatic=new User($db); - $form = new Form($db); @@ -138,14 +154,18 @@ if ($mode == 'search') if ($socid > 0) { - // On recupere les donnees societes par l'objet + // Load data of third party $objsoc = new Societe($db); $objsoc->id=$socid; $objsoc->fetch($socid,$to); + if ($objsoc->id <= 0) + { + dol_print_error($db,$objsoc->error); + } if ($errmesg) { - print "$errmesg
"; + print "".$errmesg."
"; } /* @@ -157,9 +177,6 @@ if ($socid > 0) dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company'); - /* - * - */ print ''; print ''; - print ''; + // Prefix + print ''; if ($objsoc->client) { @@ -179,9 +199,18 @@ if ($socid > 0) print $objsoc->code_client; if ($objsoc->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; print ''; + + print ''; + print ''; + print ''; } - print ""; + // Address + print '"; // Zip / Town print '"; @@ -206,7 +235,7 @@ if ($socid > 0) // Web print ''; - // Assujeti TVA ou pas + // Assujeti a TVA ou pas print ''; print ''; + // Conditions de reglement par defaut $langs->load('bills'); $html = new Form($db); @@ -260,7 +294,7 @@ if ($socid > 0) print ""; print ''; - // Mode de reglement + // Mode de reglement par defaut print '"; - print "
'; @@ -170,7 +187,10 @@ if ($socid > 0) print $form->showrefnav($objsoc,'socid','',($user->societe_id?0:1),'rowid','nom','',''); print '
'.$langs->trans('Prefix').''.$objsoc->prefix_comm.'
'.$langs->trans("Prefix").''; + print ($objsoc->prefix_comm?$objsoc->prefix_comm:' '); + print '
'; + print $form->editfieldkey("CustomerAccountancyCode",'customeraccountancycode',$objsoc->code_compta,'socid',$objsoc->id,$user->rights->societe->creer); + print ''; + print $form->editfieldval("CustomerAccountancyCode",'customeraccountancycode',$objsoc->code_compta,'socid',$objsoc->id,$user->rights->societe->creer); + print '
".$langs->trans('Address')."".nl2br($objsoc->address)."
'.$langs->trans('Address').''.nl2br($objsoc->address)."
'.$langs->trans('Zip').''.$objsoc->cp."
'.$langs->trans("Web").''.dol_print_url($objsoc->url,'_blank').'
'.$langs->trans('VATIsUsed').''; print yn($objsoc->tva_assuj); @@ -239,6 +268,11 @@ if ($socid > 0) } } + // TVA Intra + print '
'.$langs->trans('VATIntraVeryShort').''; + print $objsoc->tva_intra; + print '
'; print '
'; print $langs->trans('PaymentMode'); @@ -284,7 +318,7 @@ if ($socid > 0) print ''; print ''; print '
'; print $langs->trans("CustomerRelativeDiscountShort"); print ''; - if ($user->rights->societe->creer) + if ($user->rights->societe->creer && !$user->societe_id > 0) { print ''.img_edit($langs->trans("Modify")).''; } @@ -298,7 +332,7 @@ if ($socid > 0) print '
'; print $langs->trans("CustomerAbsoluteDiscountShort"); print ''; - if ($user->rights->societe->creer) + if ($user->rights->societe->creer && !$user->societe_id > 0) { print ''.img_edit($langs->trans("Modify")).''; } @@ -372,12 +406,13 @@ if ($socid > 0) // Nbre max d'elements des petites listes $MAXLIST=4; + $tableaushown=1; // Lien recap print ''; print ''; print ''; + print '
'; - print '
'.$langs->trans("Summary").''.$langs->trans("ShowCustomerPreview").'
'.$langs->trans("ShowCustomerPreview").'
'; print '
'; @@ -387,7 +422,6 @@ if ($socid > 0) /* * Last proposals */ - // TODO remplacer par une fonction if ($conf->propal->enabled && $user->rights->propale->lire) { $propal_static = new Propal($db); @@ -591,6 +625,75 @@ if ($socid > 0) print "
"; } + /* + * Last invoices + */ + if ($conf->facture->enabled && $user->rights->facture->lire) + { + $facturestatic = new Facture($db); + + print ''; + + $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,'; + $sql.= ' f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut,'; + $sql.= ' s.nom, s.rowid as socid,'; + $sql.= ' SUM(pf.amount) as am'; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture'; + $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$objsoc->id; + $sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,'; + $sql.= ' f.datef, f.datec, f.paye, f.fk_statut,'; + $sql.= ' s.nom, s.rowid'; + $sql.= " ORDER BY f.datef DESC, f.datec DESC"; + + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $num = $db->num_rows($resql); + $i = 0; + if ($num > 0) + { + $tableaushown=1; + print ''; + print ''; + print ''; + } + + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ""; + print ''; + if ($objp->df > 0) + { + print "\n"; + } + else + { + print "\n"; + } + print "\n"; + + print '\n"; + print "\n"; + $i++; + } + $db->free($resql); + } + else + { + dol_print_error($db); + } + print "
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' ('.$num.')
'; + $facturestatic->id=$objp->facid; + $facturestatic->ref=$objp->facnumber; + $facturestatic->type=$objp->type; + print $facturestatic->getNomUrl(1); + print '".dol_print_date($db->jdate($objp->df))."!!!".price($objp->total_ttc)."'.($facturestatic->LibStatut($objp->paye,$objp->statut,5,$objp->am))."
"; + } + /* * Last linked chronodocs */ @@ -632,12 +735,13 @@ if ($socid > 0) } print "
\n"; + print ""; + + print "\n\n"; /* - * Barre d'action - * + * Barre d'actions */ print '
'; @@ -665,9 +769,41 @@ if ($socid > 0) print ''.$langs->trans("AddIntervention").''; } - if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + // Add invoice + if ($user->societe_id == 0) { - print ''.$langs->trans("AddAction").''; + if ($conf->deplacement->enabled) + { + $langs->load("trips"); + print ''.$langs->trans("AddTrip").''; + } + + if ($conf->facture->enabled) + { + if ($user->rights->facture->creer) + { + $langs->load("bills"); + if ($objsoc->client != 0) print ''.$langs->trans("AddBill").''; + else print ''.$langs->trans("AddBill").''; + } + else + { + print ''.$langs->trans("AddBill").''; + } + } + } + + // Add action + if ($conf->agenda->enabled && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) + { + if ($user->rights->agenda->myactions->create) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } } if ($user->rights->societe->contact->creer) @@ -681,23 +817,20 @@ if ($socid > 0) } print '
'; - print '
'; + print "
\n"; - if ($conf->global->MAIN_REPEATCONTACTTASKONEACHTAB) + if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) { - /* - * Liste des contacts - */ + // List of contacts show_contacts($conf,$langs,$db,$objsoc); + } - /* - * Listes des actions a faire - */ + if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) + { + // List of todo actions show_actions_todo($conf,$langs,$db,$objsoc); - /* - * Listes des actions effectuees - */ + // List of done actions show_actions_done($conf,$langs,$db,$objsoc); } } diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 437a680c1a7..4d24c2998e9 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -262,51 +262,49 @@ if ($socid > 0) /* * Barre d'action - * */ print '
'; - print ''.$langs->trans("AddContact").''; + if ($conf->propal->enabled && $user->rights->propale->creer) + { + print ''.$langs->trans("AddProp").''; + } - if ($conf->agenda->enabled) - { - // Updated by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-action-button-behaviour.html) - // Don't force the user to add a "todo action"; he could report an action that he did - print ''.$langs->trans("AddAction").''; - } + // Add action + if ($conf->agenda->enabled && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) + { + if ($user->rights->agenda->myactions->create) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } + } - if ($conf->propal->enabled && $user->rights->propale->creer) - { - print ''.$langs->trans("AddProp").''; - } + print ''.$langs->trans("AddContact").''; - if ($conf->projet->enabled && $user->rights->projet->creer) - { - print ''.$langs->trans("AddProject").''; - } print '
'; print '
'; - if ($conf->global->MAIN_REPEATCONTACTTASKONEACHTAB) - { - /* - * Liste des contacts - */ - show_contacts($conf,$langs,$db,$societe); + if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) + { + // List of contacts + show_contacts($conf,$langs,$db,$societe); + } - /* - * Listes des actions a faire - */ - show_actions_todo($conf,$langs,$db,$societe); + if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) + { + // List of todo actions + show_actions_todo($conf,$langs,$db,$societe); - /* - * Listes des actions effectuees - */ - show_actions_done($conf,$langs,$db,$societe); - } + // List of done actions + show_actions_done($conf,$langs,$db,$societe); + } } $db->close(); diff --git a/htdocs/comm/prospect/prospects.php b/htdocs/comm/prospect/prospects.php index e63b336e554..27dc6dfc4cd 100644 --- a/htdocs/comm/prospect/prospects.php +++ b/htdocs/comm/prospect/prospects.php @@ -274,7 +274,7 @@ if ($resql) if ($user->rights->societe->client->voir || $socid) { $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; - $moreforfilter.=$htmlother->select_salesrepresentatives($search_sale,'search_sale'); + $moreforfilter.=$htmlother->select_salesrepresentatives($search_sale,'search_sale',$user); } if ($moreforfilter) { diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php deleted file mode 100644 index 4b801f4e525..00000000000 --- a/htdocs/compta/fiche.php +++ /dev/null @@ -1,455 +0,0 @@ - - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2010 Juanjo Menent - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \file htdocs/compta/fiche.php - * \ingroup compta - * \brief Page de fiche compta - * \version $Id$ - */ - -require('../main.inc.php'); -require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); -require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); - -$langs->load("companies"); -if ($conf->facture->enabled) $langs->load("bills"); -if ($conf->projet->enabled) $langs->load("projects"); -if ($conf->notification->enabled) $langs->load("mails"); - -// Security check -$socid = isset($_GET["socid"])?$_GET["socid"]:''; -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'societe',$socid,''); - - -/* - * Action - */ - -if ($mode == 'search') -{ - if ($mode-search == 'soc') - { - $sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s "; - $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; - } - - $resql=$db->query($sql); - if ($resql) - { - if ( $db->num_rows($resql) == 1) - { - $obj = $db->fetch_object($resql); - $socid = $obj->rowid; - } - $db->free(); - } - - if ($user->societe_id > 0) - { - $socid = $user->societe_id; - } - -} - -if ($_POST['action'] == 'setcustomeraccountancycode') -{ - $societe = new Societe($db); - $result=$societe->fetch($_POST['socid']); - $societe->code_compta=$_POST["customeraccountancycode"]; - $result=$societe->update($societe->id,$user,1,1,0); - if ($result < 0) - { - $mesg=join(',',$societe->errors); - } - $POST["action"]=""; - $socid=$_POST["socid"]; -} - -if ($_POST['action'] == 'setsupplieraccountancycode') -{ - $societe = new Societe($db); - $result=$societe->fetch($_POST['socid']); - $societe->code_compta_fournisseur=$_POST["supplieraccountancycode"]; - $result=$societe->update($societe->id,$user,1,0,1); - if ($result < 0) - { - $mesg=join(',',$societe->errors); - } - $POST["action"]=""; - $socid=$_POST["socid"]; -} - - - - -/* - * View - */ - -llxHeader(); - -$facturestatic=new Facture($db); -$contactstatic = new Contact($db); -$form = new Form($db); - -if ($socid > 0) -{ - $societe = new Societe($db); - $societe->fetch($socid); - if ($societe->id <= 0) - { - dol_print_error($db,$societe->error); - } - - /* - * Affichage onglets - */ - $head = societe_prepare_head($societe); - - dol_fiche_head($head, 'compta', $langs->trans("ThirdParty"),0,'company'); // Add a div - - if ($mesg) print $mesg; - - print ''; - print '\n"; - - - print '"; - print "
'; - - print ''; - - print ''; - - // Prefix - print ''; - - if ($societe->client) - { - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - } - - if ($societe->fournisseur) - { - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - } - - print '"; - - print ''; - print ''; - - // Country - print ''; - - // Phone - print ''; - - // Fax - print ''; - - // EMail - print ''; - - // Web - print ''; - - // Assujeti a TVA ou pas - print ''; - print ''; - print ''; - - // Local Taxes - if($mysoc->pays_code=='ES') - { - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''; - } - elseif($mysoc->localtax2_assuj=="1") - { - print ''; - } - } - - // TVA Intra - print ''; - - if ($societe->client == 1) - { - // Remise permanente - print ''; - print ''; - - // Reductions (Discounts-Drawbacks-Rebates) - print ''; - print ''; - print ''; - } - - print "
'.$langs->trans("Name").''; - $societe->next_prev_filter="te.client in (1,3)"; - print $form->showrefnav($societe,'socid','',($user->societe_id?0:1),'rowid','nom','',''); - print '
'.$langs->trans("Prefix").''; - print ($societe->prefix_comm?$societe->prefix_comm:' '); - print '
'.$langs->trans("CustomerCode").''; - print $societe->code_client; - if ($societe->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print '
'; - print $form->editfieldkey("CustomerAccountancyCode",'customeraccountancycode',$societe->code_compta,'socid',$societe->id,$user->rights->societe->creer); - print ''; - print $form->editfieldval("CustomerAccountancyCode",'customeraccountancycode',$societe->code_compta,'socid',$societe->id,$user->rights->societe->creer); - print '
'.$langs->trans("SupplierCode"). ''; - print $societe->code_fournisseur; - if ($societe->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; - print '
'; - print $form->editfieldkey("SupplierAccountancyCode",'supplieraccountancycode',$societe->code_compta_fournisseur,'socid',$societe->id,$user->rights->societe->creer); - print ''; - print $form->editfieldval("SupplierAccountancyCode",'supplieraccountancycode',$societe->code_compta_fournisseur,'socid',$societe->id,$user->rights->societe->creer); - print '
'.$langs->trans("Address").''.nl2br($societe->adresse)."
'.$langs->trans('Zip').''.$societe->cp.''.$langs->trans('Town').''.$societe->ville.'
'.$langs->trans('Country').''; - $img=picto_from_langcode($societe->pays_code); - if ($societe->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$societe->pays,$langs->trans("CountryIsInEEC"),1,0); - else print ($img?$img.' ':'').$societe->pays; - print '
'.$langs->trans("Phone").''.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id,'AC_TEL').''.$langs->trans("Fax").''.dol_print_phone($societe->fax,$societe->pays_code,0,$societe->id,'AC_FAX').'
'.$langs->trans('EMail').''.dol_print_email($societe->email,0,$societe->id,'AC_EMAIL').'
'.$langs->trans("Web").''.dol_print_url($societe->url,'_blank').'
'.$langs->trans('VATIsUsed').''; - print yn($societe->tva_assuj); - print '
'.$langs->trans('LocalTax1IsUsedES').''; - print yn($societe->localtax1_assuj); - print '
'.$langs->trans('LocalTax2IsUsedES').''; - print yn($societe->localtax2_assuj); - print '
'.$langs->trans("LocalTax1IsUsedES").''; - print yn($societe->localtax1_assuj); - print '
'.$langs->trans("LocalTax2IsUsedES").''; - print yn($societe->localtax2_assuj); - print '
'.$langs->trans('VATIntraVeryShort').''; - print $societe->tva_intra; - print '
'; - print '
'; - print $langs->trans("CustomerRelativeDiscountShort"); - print ''; - if (!$user->societe_id > 0) - { - print ''.img_edit($langs->trans("Modify")).''; - } - print '
'; - print '
'.($societe->remise_client?price2num($societe->remise_client,'MT').'%':$langs->trans("DiscountNone")).'
'; - print ''; - print '
'; - print $langs->trans("CustomerAbsoluteDiscountShort"); - print ''; - if (!$user->societe_id > 0) - { - print ''.img_edit($langs->trans("Modify")).''; - } - print '
'; - print '
'; - $amount_discount=$societe->getAvailableDiscounts(); - if ($amount_discount < 0) dol_print_error($db,$societe->error); - if ($amount_discount > 0) print price($amount_discount).' '.$langs->trans("Currency".$conf->monnaie); - else print $langs->trans("DiscountNone"); - print '
"; - - print "
'; - - // Nbre max d'elements des petites listes - $MAXLIST=5; - $tableaushown=1; - - // Lien recap - print ''; - print ''; - print ''; - print ''; - print '
'; - print '
'.$langs->trans("Summary").''.$langs->trans("ShowAccountancyPreview").'
'; - print '
'; - - /* - * Last invoices - */ - if ($conf->facture->enabled && $user->rights->facture->lire) - { - $facturestatic = new Facture($db); - - print ''; - - $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,'; - $sql.= ' f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut,'; - $sql.= ' s.nom, s.rowid as socid,'; - $sql.= ' SUM(pf.amount) as am'; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture'; - $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id; - $sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,'; - $sql.= ' f.datef, f.datec, f.paye, f.fk_statut,'; - $sql.= ' s.nom, s.rowid'; - $sql.= " ORDER BY f.datef DESC, f.datec DESC"; - - $resql=$db->query($sql); - if ($resql) - { - $var=true; - $num = $db->num_rows($resql); - $i = 0; - if ($num > 0) - { - $tableaushown=1; - print ''; - print ''; - print ''; - } - - while ($i < $num && $i < $MAXLIST) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print ''; - if ($objp->df > 0) - { - print "\n"; - } - else - { - print "\n"; - } - print "\n"; - - print '\n"; - print "\n"; - $i++; - } - $db->free($resql); - } - else - { - dol_print_error($db); - } - print "
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' ('.$num.')
'; - $facturestatic->id=$objp->facid; - $facturestatic->ref=$objp->facnumber; - $facturestatic->type=$objp->type; - print $facturestatic->getNomUrl(1); - print '".dol_print_date($db->jdate($objp->df))."!!!".price($objp->total_ttc)."'.($facturestatic->LibStatut($objp->paye,$objp->statut,5,$objp->am))."
"; - } - - print "
"; - - print "\n\n"; - - - /* - * Barre d'actions - */ - print '
'; - - if ($user->societe_id == 0) - { - // Si societe cliente ou prospect, on affiche bouton "Creer facture client" - if ($conf->facture->enabled) - { - if ($user->rights->facture->creer) - { - $langs->load("bills"); - if ($societe->client != 0) print ''.$langs->trans("AddBill").''; - else print ''.$langs->trans("AddBill").''; - } - else - { - print ''.$langs->trans("AddBill").''; - } - } - - if ($conf->deplacement->enabled) - { - $langs->load("trips"); - print ''.$langs->trans("AddTrip").''; - } - } - - // Add action - if ($conf->agenda->enabled) - { - if ($user->rights->agenda->myactions->create) - { - print ''.$langs->trans("AddAction").''; - } - else - { - print ''.$langs->trans("AddAction").''; - } - } - - if ($user->rights->societe->contact->creer) - { - print "id."&action=create\">".$langs->trans("AddContact").""; - } - - print '
'; - print "
\n"; - - - if ($conf->global->MAIN_REPEATCONTACTTASKONEACHTAB) - { - /* - * Liste des contacts - */ - show_contacts($conf,$langs,$db,$societe); - - /* - * Listes des actions a faire - */ - show_actions_todo($conf,$langs,$db,$societe); - - /* - * Listes des actions effectuees - */ - show_actions_done($conf,$langs,$db,$societe); - } -} -else -{ - dol_print_error($db,'Bad value for socid parameter'); -} -$db->close(); - - -llxFooter('$Date$ - $Revision$'); -?> diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 5c779debd20..ef66b156e0e 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -57,7 +57,7 @@ if ($socid > 0) */ $head = societe_prepare_head($societe); - dol_fiche_head($head, 'compta', $langs->trans("ThirdParty"), 0, 'company'); + dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company'); print "\n"; print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; } + // Address print ''; + // Zip / Town print ''; print ''; @@ -303,10 +333,18 @@ if ( $societe->fetch($socid) ) print ''.$langs->trans("AddBill").''; } - if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) - { - print ''.$langs->trans("AddAction").''; - } + // Add action + if ($conf->agenda->enabled && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) + { + if ($user->rights->agenda->myactions->create) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } + } if ($user->rights->societe->contact->creer) { @@ -316,24 +354,20 @@ if ( $societe->fetch($socid) ) print ''; print '
'; - if ($conf->global->MAIN_REPEATCONTACTTASKONEACHTAB) - { - /* - * Liste des contacts - */ - show_contacts($conf,$langs,$db,$societe); + if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) + { + // List of contacts + show_contacts($conf,$langs,$db,$societe); + } - /* - * Listes des actions a faire - */ - show_actions_todo($conf,$langs,$db,$societe); - - /* - * Listes des actions effectuees - */ - show_actions_done($conf,$langs,$db,$societe); - } + if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) + { + // List of todo actions + show_actions_todo($conf,$langs,$db,$societe); + // List of done actions + show_actions_done($conf,$langs,$db,$societe); + } } else { diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index 5480da1c136..7d5ca2dc4c6 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -44,11 +44,6 @@ function societe_prepare_head($objsoc) $head[$h][2] = 'company'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Agenda"); - $head[$h][2] = 'agenda'; - $h++; - if ($objsoc->client==1 || $objsoc->client==3 || $objsoc->object->client==1 || $objsoc->object->client==3) { $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; @@ -70,14 +65,19 @@ function societe_prepare_head($objsoc) $head[$h][2] = 'supplier'; $h++; } - if ($conf->facture->enabled || $conf->compta->enabled || $conf->accounting->enabled) + /*if ($conf->facture->enabled || $conf->compta->enabled || $conf->accounting->enabled) { $langs->load("compta"); $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Accountancy"); $head[$h][2] = 'compta'; $h++; - } + }*/ + + $head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Agenda"); + $head[$h][2] = 'agenda'; + $h++; //show categorie tab if ($conf->categorie->enabled) @@ -165,7 +165,7 @@ function societe_prepare_head2($objsoc) $h++; $head[$h][0] = 'lien.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Links"); + $head[$h][1] = $langs->trans("ParentCompany"); $head[$h][2] = 'links'; $h++; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 50dc2f87d7e..fde35e4558d 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -150,15 +150,38 @@ if ($_GET["socid"]) if ($mesg) print($mesg); - /* - * Listes des actions a faire - */ - show_actions_todo($conf,$langs,$db,$soc); + /* + * Barre d'action + */ + + print '
'; + + if ($conf->agenda->enabled) + { + print ''.$langs->trans("AddAction").''; + } + + print '
'; + + print '
'; + +/* + if ($conf->global->MAIN_REPEATCONTACTONEACHTAB) + { + // List of contacts + show_contacts($conf,$langs,$db,$societe); + } + + if ($conf->global->MAIN_REPEATTASKONEACHTAB) + { +*/ + // List of todo actions + show_actions_todo($conf,$langs,$db,$soc); + + // List of done actions + show_actions_done($conf,$langs,$db,$soc); +// } - /* - * Listes des actions effectuees - */ - show_actions_done($conf,$langs,$db,$soc); } diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 09b882d3ef4..7acc91fbe76 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2010 Laurent Destailleur * * 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 @@ -53,10 +53,12 @@ if($_GET["socid"] && $_GET["commid"]) $soc->add_commercial($user, $_GET["commid"]); Header("Location: commerciaux.php?socid=".$soc->id); + exit; } else { Header("Location: commerciaux.php?socid=".$_GET["socid"]); + exit; } } @@ -144,25 +146,18 @@ if ($_GET["socid"]) { $obj = $db->fetch_object($resql); - if (!$user->rights->societe->client->voir) + print ''; + print img_object($langs->trans("ShowUser"),"user").' '; + print $obj->firstname." " .$obj->name."\n"; + print ' '; + if ($user->rights->societe->creer) { - print ''; - print img_object($langs->trans("ShowUser"),"user").' '; - print stripslashes($obj->firstname)." " .stripslashes($obj->name)."\n"; - print '
'; - $i++; - } - else - { - print ''; - print img_object($langs->trans("ShowUser"),"user").' '; - print $obj->firstname." " .$obj->name."\n"; - print ' '; - print ''; - print img_delete(); - print '
'; - $i++; + print ''; + print img_delete(); + print ''; } + print '
'; + $i++; } $db->free($resql); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 89296897417..157d75f7f5a 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1650,7 +1650,13 @@ else { $num = $db->num_rows($resql); $obj = $db->fetch_object($resql); - print $obj->nb?($obj->nb):$langs->trans("NoSalesRepresentativeAffected"); + if ($obj->nb) + { + print ''; + print $obj->nb; + print ''; + } + else print $langs->trans("NoSalesRepresentativeAffected"); } else { dol_print_error($db); @@ -1700,7 +1706,12 @@ else print ''.$langs->trans("AddContact").''; } - if ($user->rights->societe->supprimer) + if ($conf->projet->enabled && $user->rights->projet->creer) + { + print ''.$langs->trans("AddProject").''; + } + + if ($user->rights->societe->supprimer) { print ''.$langs->trans('Delete').''; }
'; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index dd3c855a450..3e44624db93 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -218,7 +218,8 @@ class Conf if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US"; // By default, we repeat info on all tabs - if (! isset($this->global->MAIN_REPEATCONTACTTASKONEACHTAB)) $this->global->MAIN_REPEATCONTACTTASKONEACHTAB=1; + if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1; + //if (! isset($this->global->MAIN_REPEATTASKONEACHTAB)) $this->global->MAIN_REPEATTASKONEACHTAB=1; No more required as we have now an agenda tab $rootfordata = DOL_DATA_ROOT; $rootforuser = DOL_DATA_ROOT; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 00cc5ad6d58..bbb0b8bf4e2 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -269,12 +269,13 @@ class FormOther /** - * \brief Return select list for categories (to use in form search selectors) - * \param selected Preselected value - * \param htmlname Name of combo list - * \return return Html combo list code + * Return select list for categories (to use in form search selectors) + * @param selected Preselected value + * @param htmlname Name of combo list + * @param user Object user + * @return return Html combo list code */ - function select_salesrepresentatives($selected=0,$htmlname='search_sale') + function select_salesrepresentatives($selected=0,$htmlname='search_sale',$user) { global $conf; @@ -282,12 +283,24 @@ class FormOther $moreforfilter =''; @@ -313,7 +326,7 @@ class FormOther } /** - * \brief Retourn list of project and tasks + * \brief Return list of project and tasks * \param selectedtask Pre-selected task * \param projectid Project id * \param htmlname Name of html select diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 18868942c63..406a56ee0cb 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -46,6 +46,25 @@ if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'societe',$socid,''); +/* + * Action + */ + +if ($_POST['action'] == 'setsupplieraccountancycode') +{ + $societe = new Societe($db); + $result=$societe->fetch($_POST['socid']); + $societe->code_compta_fournisseur=$_POST["supplieraccountancycode"]; + $result=$societe->update($societe->id,$user,1,0,1); + if ($result < 0) + { + $mesg=join(',',$societe->errors); + } + $POST["action"]=""; + $socid=$_POST["socid"]; +} + + /* * View @@ -80,15 +99,26 @@ if ( $societe->fetch($socid) ) if ($societe->fournisseur) { - print '
'; - print $langs->trans('SupplierCode').''; - print $societe->code_fournisseur; - if ($societe->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; - print '
'.$langs->trans("SupplierCode"). ''; + print $societe->code_fournisseur; + if ($societe->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + print '
'; + print $form->editfieldkey("SupplierAccountancyCode",'supplieraccountancycode',$societe->code_compta_fournisseur,'socid',$societe->id,$user->rights->societe->creer); + print ''; + print $form->editfieldval("SupplierAccountancyCode",'supplieraccountancycode',$societe->code_compta_fournisseur,'socid',$societe->id,$user->rights->societe->creer); + print '
'.$langs->trans("Address").''.nl2br($societe->address).'
'.$langs->trans("Zip").''.$societe->cp.''.$langs->trans("Town").''.$societe->ville.'