diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 2e577b401df..646810d52a5 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -22,11 +22,11 @@ */ /** - \file htdocs/comm/fiche.php - \ingroup commercial - \brief Onglet client de la fiche societe - \version $Id$ -*/ + * \file htdocs/comm/fiche.php + * \ingroup commercial + * \brief Onglet client de la fiche societe + * \version $Id$ + */ require_once("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); @@ -61,72 +61,70 @@ if (! $sortfield) $sortfield="nom"; if ($_GET["action"] == 'attribute_prefix' && $user->rights->societe->creer) { - $societe = new Societe($db, $_GET["socid"]); - $societe->attribute_prefix($db, $_GET["socid"]); + $societe = new Societe($db, $_GET["socid"]); + $societe->attribute_prefix($db, $_GET["socid"]); } // conditions de reglement if ($_POST["action"] == 'setconditions' && $user->rights->societe->creer) { $societe = new Societe($db, $_GET["socid"]); - $societe->cond_reglement=$_POST['cond_reglement_id']; + $societe->cond_reglement=$_POST['cond_reglement_id']; $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET cond_reglement='".$_POST['cond_reglement_id']; $sql.= "' WHERE rowid='".$_GET["socid"]."'"; - $result = $db->query($sql); - if (! $result) dol_print_error($result); + $result = $db->query($sql); + if (! $result) dol_print_error($result); } // mode de reglement if ($_POST["action"] == 'setmode' && $user->rights->societe->creer) { - $societe = new Societe($db, $_GET["socid"]); - $societe->mode_reglement=$_POST['mode_reglement_id']; + $societe = new Societe($db, $_GET["socid"]); + $societe->mode_reglement=$_POST['mode_reglement_id']; $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET mode_reglement='".$_POST['mode_reglement_id']; $sql.= "' WHERE rowid='".$_GET["socid"]."'"; - $result = $db->query($sql); - if (! $result) dol_print_error($result); + $result = $db->query($sql); + if (! $result) dol_print_error($result); } // assujetissement a la TVA if ($_POST["action"] == 'setassujtva' && $user->rights->societe->creer) { $societe = new Societe($db, $_GET["socid"]); - $societe->tva_assuj=$_POST['assujtva_value']; + $societe->tva_assuj=$_POST['assujtva_value']; $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$socid."'"; - $result = $db->query($sql); - if (! $result) dol_print_error($result); + $result = $db->query($sql); + if (! $result) dol_print_error($result); } + /* - * Recherche - * + * View */ -if ($mode == 'search') { - if ($mode-search == 'soc') { - $sql = "SELECT s.rowid"; - if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; - if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - } - if ( $db->query($sql) ) { - if ( $db->num_rows() == 1) { - $obj = $db->fetch_object(); - $socid = $obj->rowid; - } - $db->free(); - } +if ($mode == 'search') +{ + if ($mode-search == 'soc') + { + $sql = "SELECT s.rowid"; + if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; + if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + } + + if ( $db->query($sql) ) + { + if ( $db->num_rows() == 1) + { + $obj = $db->fetch_object(); + $socid = $obj->rowid; + } + $db->free(); + } } - -/********************************************************************************* - * - * Mode fiche - * - *********************************************************************************/ - llxHeader('',$langs->trans('CustomerCard')); $userstatic=new User($db); @@ -135,53 +133,53 @@ $form = new Form($db); if ($socid > 0) { - // On recupere les donnees societes par l'objet - $objsoc = new Societe($db); - $objsoc->id=$socid; - $objsoc->fetch($socid,$to); + // On recupere les donnees societes par l'objet + $objsoc = new Societe($db); + $objsoc->id=$socid; + $objsoc->fetch($socid,$to); - if ($errmesg) - { - print "$errmesg
"; - } + if ($errmesg) + { + print "$errmesg
"; + } - /* - * Affichage onglets - */ + /* + * Affichage onglets + */ $head = societe_prepare_head($objsoc); - dol_fiche_head($head, 'customer', $langs->trans("ThirdParty")); + dol_fiche_head($head, 'customer', $langs->trans("ThirdParty")); - /* - * - */ - print ''; - print '
'; + /* + * + */ + print ''; + print ''; print ''; } - print "
'; - print ''; + print '
'; - print ''; + print ''; - print ''; + print ''; - if ($objsoc->client) - { - print ''; - } + if ($objsoc->client) + { + print ''; + } - print ""; + print ""; - // Zip / Town - print '"; - print '"; + // Zip / Town + print '"; + print '"; // Country print ''; - // Phone - print ''; + // Phone + print ''; - // Fax + // Fax print ''; - // EMail + // EMail print ''; // Web - print ''; + print ''; // Assujeti TVA ou pas print ''; @@ -248,38 +246,38 @@ if ($socid > 0) print ""; print ''; - // Reductions relative (Remises-Ristournes-Rabbais) - print ''; - print ''; + // Reductions relative (Remises-Ristournes-Rabbais) + print ''; + print ''; - // Reductions absolues (Remises-Ristournes-Rabbais) - print ''; - print ''; - print ''; + // Reductions absolues (Remises-Ristournes-Rabbais) + print ''; + print ''; + print ''; // Multiprice level if ($conf->global->PRODUIT_MULTIPRICES) @@ -305,293 +303,293 @@ if ($socid > 0) print $langs->trans("DeliveriesAddress"); print '
'.$langs->trans("Name").''; - print $objsoc->nom; - print '
'.$langs->trans("Name").''; + print $objsoc->nom; + print '
'.$langs->trans('Prefix').''.$objsoc->prefix_comm.'
'.$langs->trans('Prefix').''.$objsoc->prefix_comm.'
'; - print $langs->trans('CustomerCode').''; - print $objsoc->code_client; - if ($objsoc->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print '
'; + print $langs->trans('CustomerCode').''; + print $objsoc->code_client; + if ($objsoc->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + print '
".$langs->trans('Address')."".nl2br($objsoc->adresse)."
".$langs->trans('Address')."".nl2br($objsoc->adresse)."
'.$langs->trans('Zip').''.$objsoc->cp."'.$langs->trans('Town').''.$objsoc->ville."
'.$langs->trans('Zip').''.$objsoc->cp."'.$langs->trans('Town').''.$objsoc->ville."
'.$langs->trans("Country").''; @@ -189,17 +187,17 @@ if ($socid > 0) else print $objsoc->pays; print '
'.$langs->trans('Phone').''.dol_print_phone($objsoc->tel,$objsoc->pays_code,0,$objsoc->id,'AC_TEL').'
'.$langs->trans('Phone').''.dol_print_phone($objsoc->tel,$objsoc->pays_code,0,$objsoc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($objsoc->fax,$objsoc->pays_code,0,$objsoc->id,'AC_FAX').'
'.$langs->trans('EMail').''.dol_print_email($objsoc->email,0,$objsoc->id,'AC_EMAIL').'
'.$langs->trans("Web").''.dol_print_url($objsoc->url,'_blank').'
'.$langs->trans("Web").''.dol_print_url($objsoc->url,'_blank').'
'; - print '
'; - print $langs->trans("CustomerRelativeDiscountShort"); - print ''; - if ($user->rights->societe->creer) - { - print ''.img_edit($langs->trans("Modify")).''; - } - print '
'; - print '
'.($objsoc->remise_client?$objsoc->remise_client.'%':$langs->trans("DiscountNone")).'
'; + print '
'; + print $langs->trans("CustomerRelativeDiscountShort"); + print ''; + if ($user->rights->societe->creer) + { + print ''.img_edit($langs->trans("Modify")).''; + } + print '
'; + print '
'.($objsoc->remise_client?$objsoc->remise_client.'%':$langs->trans("DiscountNone")).'
'; - print ''; - print '
'; - print $langs->trans("CustomerAbsoluteDiscountShort"); - print ''; - if ($user->rights->societe->creer) - { - print ''.img_edit($langs->trans("Modify")).''; - } - print '
'; - print '
'; - $amount_discount=$objsoc->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 ''; + print '
'; + print $langs->trans("CustomerAbsoluteDiscountShort"); + print ''; + if ($user->rights->societe->creer) + { + print ''.img_edit($langs->trans("Modify")).''; + } + print '
'; + print '
'; + $amount_discount=$objsoc->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 '
'; if ($user->rights->societe->creer) - { - print ''.img_edit($langs->trans("Modify")).''; - } + { + print ''.img_edit($langs->trans("Modify")).''; + } print '
'; print '
'; $sql = "SELECT count(rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe_adresse_livraison"; - $sql.= " WHERE fk_societe =".$objsoc->id; + $sql.= " FROM ".MAIN_DB_PREFIX."societe_adresse_livraison"; + $sql.= " WHERE fk_societe =".$objsoc->id; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $objal = $db->fetch_object($resql); - print $objal->nb?($objal->nb):$langs->trans("NoOtherDeliveryAddress"); - } - else - { - dol_print_error($db); - } + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $objal = $db->fetch_object($resql); + print $objal->nb?($objal->nb):$langs->trans("NoOtherDeliveryAddress"); + } + else + { + dol_print_error($db); + } print '
"; + print "
"; - print "\n"; + print "\n"; - print ''; + print ''; - // Nbre max d'elements des petites listes - $MAXLIST=4; + // Nbre max d'elements des petites listes + $MAXLIST=4; - // Lien recap - print ''; - print ''; - print ''; - print ''; - print '
'; - print '
'.$langs->trans("Summary").''.$langs->trans("ShowCustomerPreview").'
'; - print '
'; + // Lien recap + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'.$langs->trans("Summary").''.$langs->trans("ShowCustomerPreview").'
'; + print '
'; $now=gmmktime(); - /* - * Last proposals - */ - if ($conf->propal->enabled && $user->rights->propale->lire) - { - $propal_static=new Propal($db); + /* + * Last proposals + */ + if ($conf->propal->enabled && $user->rights->propale->lire) + { + $propal_static=new Propal($db); - print ''; + print '
'; - $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, "; - $sql.= " ".$db->pdate("p.datep")." as dp, ".$db->pdate("p.fin_validite")." as datelimite"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; - $sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; - $sql .= " AND s.rowid = ".$objsoc->id; - $sql .= " ORDER BY p.datep DESC"; + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, "; + $sql.= " ".$db->pdate("p.datep")." as dp, ".$db->pdate("p.fin_validite")." as datelimite"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; + $sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; + $sql .= " AND s.rowid = ".$objsoc->id; + $sql .= " ORDER BY p.datep DESC"; - $resql=$db->query($sql); - if ($resql) - { - $var=true; - $num = $db->num_rows($resql); - if ($num > 0) - { - print ''; - print ''; - print ''; - $var=!$var; - } - $i = 0; - while ($i < $num && $i < $MAXLIST) - { - $objp = $db->fetch_object($resql); - print ""; - print "\n"; - print ''; - print ''; - $var=!$var; - $i++; - } - $db->free($resql); - } - else { - dol_print_error($db); - } - print "
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')
propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; - if ( ($objp->dp < $now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) - { - print " ".img_warning(); - } - print ''.dol_print_date($objp->dp,'day')."'.price($objp->total_ht).''.$propal_static->LibStatut($objp->fk_statut,5).'
"; - } + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $num = $db->num_rows($resql); + if ($num > 0) + { + print ''; + print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')
'; + print ''; + $var=!$var; + } + $i = 0; + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object($resql); + print ""; + print "propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; + if ( ($objp->dp < $now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) + { + print " ".img_warning(); + } + print ''.dol_print_date($objp->dp,'day')."\n"; + print ''.price($objp->total_ht).''; + print ''.$propal_static->LibStatut($objp->fk_statut,5).''; + $var=!$var; + $i++; + } + $db->free($resql); + } + else { + dol_print_error($db); + } + print ""; + } - /* - * Last orders - */ - if ($conf->commande->enabled && $user->rights->commande->lire) - { - $commande_static=new Commande($db); + /* + * Last orders + */ + if ($conf->commande->enabled && $user->rights->commande->lire) + { + $commande_static=new Commande($db); - print ''; + print '
'; - $sql = "SELECT s.nom, s.rowid,"; - $sql.= " c.rowid as cid, c.total_ht, c.ref, c.fk_statut, c.facture,"; - $sql.= " ".$db->pdate("c.date_commande")." as dc"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; - $sql.= " WHERE c.fk_soc = s.rowid "; - $sql.= " AND s.rowid = ".$objsoc->id; - $sql.= " ORDER BY c.date_commande DESC"; + $sql = "SELECT s.nom, s.rowid,"; + $sql.= " c.rowid as cid, c.total_ht, c.ref, c.fk_statut, c.facture,"; + $sql.= " ".$db->pdate("c.date_commande")." as dc"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; + $sql.= " WHERE c.fk_soc = s.rowid "; + $sql.= " AND s.rowid = ".$objsoc->id; + $sql.= " ORDER BY c.date_commande DESC"; - $resql=$db->query($sql); - if ($resql) - { - $var=true; - $num = $db->num_rows($resql); - if ($num >0 ) - { - print ''; - print ''; - print ''; - } - $i = 0; - while ($i < $num && $i < $MAXLIST) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print '\n"; - print ''; - print ''; - $i++; - } - $db->free($resql); - } - else { - dol_print_error($db); - } - print "
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')
'.img_object($langs->trans("ShowOrder"),"order").' '.$objp->ref."\n"; - print ''.dol_print_date($objp->dc,'day')."'.price($objp->total_ht).''.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).'
"; - } + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $num = $db->num_rows($resql); + if ($num >0 ) + { + print ''; + print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')
'; + print ''; + } + $i = 0; + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ""; + print ''.img_object($langs->trans("ShowOrder"),"order").' '.$objp->ref."\n"; + print ''.dol_print_date($objp->dc,'day')."\n"; + print ''.price($objp->total_ht).''; + print ''.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).''; + $i++; + } + $db->free($resql); + } + else { + dol_print_error($db); + } + print ""; + } - /* - * Last linked contracts - */ - if ($conf->contrat->enabled && $user->rights->contrat->lire) - { - $contratstatic=new Contrat($db); + /* + * Last linked contracts + */ + if ($conf->contrat->enabled && $user->rights->contrat->lire) + { + $contratstatic=new Contrat($db); - print ''; + print '
'; - $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, ".$db->pdate("c.datec")." as dc"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; - $sql .= " WHERE c.fk_soc = s.rowid "; - $sql .= " AND s.rowid = ".$objsoc->id; - $sql .= " ORDER BY c.datec DESC"; + $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, ".$db->pdate("c.datec")." as dc"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; + $sql .= " WHERE c.fk_soc = s.rowid "; + $sql .= " AND s.rowid = ".$objsoc->id; + $sql .= " ORDER BY c.datec DESC"; - $resql=$db->query($sql); - if ($resql) - { - $var=true; - $num = $db->num_rows($resql); - if ($num >0 ) - { - print ''; - print ''; - print ''; - } - $i = 0; - while ($i < $num && $i < $MAXLIST) - { - $contrat=new Contrat($db); + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $num = $db->num_rows($resql); + if ($num >0 ) + { + print ''; + print ''; + print ''; + } + $i = 0; + while ($i < $num && $i < $MAXLIST) + { + $contrat=new Contrat($db); - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print '\n"; - print '\n"; - print ''; - print '\n"; - print ''; - $i++; - } - $db->free($resql); - } - else { - dol_print_error($db); - } - print "
'; - print '
'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllContracts").' ('.$num.')
'; + print '
'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllContracts").' ('.$num.')
'; - $contrat->id=$objp->id; - $contrat->ref=$objp->ref?$objp->ref:$objp->id; - print $contrat->getNomUrl(1,12); - print "'.dol_print_date($objp->dc,'day')." '; - $contrat->fetch_lignes(); - print $contrat->getLibStatut(4); - print "
"; - } + $objp = $db->fetch_object($resql); + $var=!$var; + print ""; + print ''; + $contrat->id=$objp->id; + $contrat->ref=$objp->ref?$objp->ref:$objp->id; + print $contrat->getNomUrl(1,12); + print "\n"; + print ''.dol_print_date($objp->dc,'day')."\n"; + print ' '; + print ''; + $contrat->fetch_lignes(); + print $contrat->getLibStatut(4); + print "\n"; + print ''; + $i++; + } + $db->free($resql); + } + else { + dol_print_error($db); + } + print ""; + } - /* - * Dernieres interventions - */ - if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) - { - print ''; + /* + * Last interventions + */ + if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) + { + print '
'; - $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, ".$db->pdate("f.datei")." as di"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f"; - $sql .= " WHERE f.fk_soc = s.rowid"; - $sql .= " AND s.rowid = ".$objsoc->id; - $sql .= " ORDER BY f.datei DESC"; + $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, ".$db->pdate("f.datei")." as di"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f"; + $sql .= " WHERE f.fk_soc = s.rowid"; + $sql .= " AND s.rowid = ".$objsoc->id; + $sql .= " ORDER BY f.tms DESC"; - $resql=$db->query($sql); - if ($resql) - { - $var=true; - $num = $db->num_rows($resql); - if ($num >0 ) - { - print ''; - print ''; - print ''; - $var=!$var; - } - $i = 0; - while ($i < $num && $i < $MAXLIST) - { - $objp = $db->fetch_object($resql); - print ""; - print '\n"; - print ''; - $var=!$var; - $i++; - } - $db->free($resql); - } - else { - dol_print_error($db); - } - print "
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' ('.$num.')
".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; - print "".dol_print_date($objp->di,'day')."
"; - } + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $num = $db->num_rows($resql); + if ($num >0 ) + { + print ''; + print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' ('.$num.')
'; + print ''; + $var=!$var; + } + $i = 0; + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object($resql); + print ""; + print '".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; + print "".dol_print_date($objp->di,'day')."\n"; + print ''; + $var=!$var; + $i++; + } + $db->free($resql); + } + else { + dol_print_error($db); + } + print ""; + } - /* - * Last linked projects - */ - if ($conf->projet->enabled && $user->rights->projet->lire) - { - print ''; + /* + * Last linked projects + */ + if ($conf->projet->enabled && $user->rights->projet->lire) + { + print '
'; - $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; - $sql .= " WHERE p.fk_soc = $objsoc->id"; - $sql .= " ORDER BY p.dateo DESC"; + $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql .= " WHERE p.fk_soc = $objsoc->id"; + $sql .= " ORDER BY p.dateo DESC"; - $result=$db->query($sql); - if ($result) { - $var=true; - $i = 0 ; - $num = $db->num_rows($result); - if ($num > 0) { - print ''; - print ''; - print ''; - } - while ($i < $num && $i < $MAXLIST) { - $obj = $db->fetch_object($result); - $var = !$var; - print ""; - print ''; + $result=$db->query($sql); + if ($result) { + $var=true; + $i = 0 ; + $num = $db->num_rows($result); + if ($num > 0) { + print ''; + print ''; + print ''; + } + while ($i < $num && $i < $MAXLIST) { + $obj = $db->fetch_object($result); + $var = !$var; + print ""; + print ''; - print ""; - $i++; - } - $db->free($result); - } - else - { - dol_print_error($db); - } - print "
'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
'.img_object($langs->trans("ShowProject"),"project")." ".$obj->title.'
'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
'.img_object($langs->trans("ShowProject"),"project")." ".$obj->title.'".$obj->ref ."
"; - } + print "".$obj->ref .""; + $i++; + } + $db->free($result); + } + else + { + dol_print_error($db); + } + print ""; + } /* * Last linked chronodocs @@ -603,103 +601,103 @@ if ($socid > 0) $result=$chronodocs_static->get_list($MAXLIST,0,"f.date_c","DESC",$objsoc->id); if (is_array($result)) { - $var=true; - $i = 0 ; + $var=true; + $i = 0 ; //$num = sizeOf($result); $num=$chronodocs_static->get_nb_chronodocs($objsoc->id); if ($num > 0) { - print ''; - print '
'.$langs->trans("LastChronodocs",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllChronodocs").' ('.$num.')
'; - print ''; - } - while ($i < $num && $i < $MAXLIST) { - $obj = array_shift($result); - $var = !$var; - print ""; - print ''.img_object($langs->trans("ShowChronodocs"),"generic")." ".$obj->ref.''; + print ''; + print '
'.$langs->trans("LastChronodocs",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllChronodocs").' ('.$num.')
'; + print ''; + } + while ($i < $num && $i < $MAXLIST) { + $obj = array_shift($result); + $var = !$var; + print ""; + print ''.img_object($langs->trans("ShowChronodocs"),"generic")." ".$obj->ref.''; - print "".dol_trunc($obj->title,30) .""; + print "".dol_trunc($obj->title,30) .""; print "".dol_print_date($obj->dp,'day')."\n"; print ""; - $i++; - } + $i++; + } } print ""; } - print ""; - print "\n"; + print ""; + print "\n"; - /* - * Barre d'action - * - */ - print '
'; + /* + * Barre d'action + * + */ + print '
'; - if ($conf->propal->enabled && $user->rights->propale->creer) - { - $langs->load("propal"); - print ''.$langs->trans("AddProp").''; - } + if ($conf->propal->enabled && $user->rights->propale->creer) + { + $langs->load("propal"); + print ''.$langs->trans("AddProp").''; + } - if ($conf->commande->enabled && $user->rights->commande->creer) - { - $langs->load("orders"); - print ''.$langs->trans("AddOrder").''; - } + if ($conf->commande->enabled && $user->rights->commande->creer) + { + $langs->load("orders"); + print ''.$langs->trans("AddOrder").''; + } - if ($user->rights->contrat->creer) - { - $langs->load("contracts"); - print ''.$langs->trans("AddContract").''; - } + if ($user->rights->contrat->creer) + { + $langs->load("contracts"); + print ''.$langs->trans("AddContract").''; + } - if ($conf->ficheinter->enabled && $user->rights->ficheinter->creer) - { - $langs->load("fichinter"); - print ''.$langs->trans("AddIntervention").''; - } + if ($conf->ficheinter->enabled && $user->rights->ficheinter->creer) + { + $langs->load("fichinter"); + print ''.$langs->trans("AddIntervention").''; + } - if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) - { - print ''.$langs->trans("AddAction").''; - } + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''.$langs->trans("AddAction").''; + } if ($user->rights->societe->contact->creer) { - print ''.$langs->trans("AddContact").''; + print ''.$langs->trans("AddContact").''; } if(!empty($conf->global->MAIN_MODULE_CHRONODOCS) && $user->rights->chronodocs->entries->write) { - print ''.$langs->trans("AddChronodoc").''; + print ''.$langs->trans("AddChronodoc").''; } - print '
'; - print '
'; + print '
'; + print '
'; /* - * Liste des contacts - */ + * Liste des contacts + */ show_contacts($conf,$langs,$db,$objsoc); - /* - * Listes des actions a faire - */ + /* + * Listes des actions a faire + */ show_actions_todo($conf,$langs,$db,$objsoc); - /* - * Listes des actions effectuees - */ + /* + * Listes des actions effectuees + */ show_actions_done($conf,$langs,$db,$objsoc); } else { - dol_print_error($db,'Bad value for socid parameter'); + dol_print_error($db,'Bad value for socid parameter'); } $db->close();