Esempio n. 1
0
$langs->load("companies");
// Security check
$id = GETPOST('id', 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
/*
 *	View
 */
$title = !empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses");
llxHeader('', $title, 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
$form = new Form($db);
$contact = new Contact($db);
$contact->fetch($id, $user);
$head = contact_prepare_head($contact);
dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
/*
 * Fiche en mode visu
 */
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/contact/list.php">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td>' . $langs->trans("Ref") . '</td><td colspan="3">';
print $form->showrefnav($contact, 'id', $linkback);
print '</td></tr>';
// Name
print '<tr><td width="20%">' . $langs->trans("Lastname") . ' / ' . $langs->trans("Label") . '</td><td>' . $contact->lastname . '</td>';
print '<td width="20%">' . $langs->trans("Firstname") . '</td><td width="25%">' . $contact->firstname . '</td></tr>';
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
 static function getHeadForObject($tab_object, $fk_object)
 {
     global $db, $conf, $langs, $user;
     $head = array();
     if (empty($tab_object)) {
         return $head;
     }
     if ($tab_object === 'product') {
         dol_include_once('/product/class/product.class.php');
         dol_include_once('/core/lib/product.lib.php');
         $object = new Product($db);
         $object->fetch($fk_object);
         $head = product_prepare_head($object);
     } else {
         if ($tab_object === 'thirdparty') {
             dol_include_once('/societe/class/societe.class.php');
             dol_include_once('/core/lib/company.lib.php');
             $object = new Societe($db);
             $object->fetch($fk_object);
             $head = societe_prepare_head($object);
         } else {
             if ($tab_object === 'contact') {
                 dol_include_once('/contact/class/contact.class.php');
                 dol_include_once('/core/lib/contact.lib.php');
                 $object = new Contact($db);
                 $object->fetch($fk_object);
                 $head = contact_prepare_head($object);
             } else {
                 if ($tab_object === 'user') {
                     dol_include_once('/user/class/user.class.php');
                     dol_include_once('/core/lib/usergroups.lib.php');
                     $object = new User($db);
                     $object->fetch($fk_object);
                     $head = user_prepare_head($object);
                 } else {
                     if ($tab_object === 'group') {
                         dol_include_once('/user/class/usergroup.class.php');
                         dol_include_once('/lib/usergroups.lib.php');
                         $object = new UserGroup($db);
                         $object->fetch($fk_object);
                         $head = group_prepare_head($object);
                     } else {
                         if ($tab_object === 'project') {
                             dol_include_once('/projet/class/project.class.php');
                             dol_include_once('/core/lib/project.lib.php');
                             $object = new Project($db);
                             $object->fetch($fk_object);
                             $head = project_prepare_head($object);
                         }
                     }
                 }
             }
         }
     }
     return $head;
 }
Esempio n. 3
0
    $result = $object->update_perso($id, $user);
    if ($result > 0) {
        $object->old_name = '';
        $object->old_firstname = '';
    } else {
        $error = $object->error;
    }
}
/*
 *	View
 */
$now = dol_now();
llxHeader('', $langs->trans("ContactsAddresses"), 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
$form = new Form($db);
$object->fetch($id, $user);
$head = contact_prepare_head($object);
dol_fiche_head($head, 'perso', $langs->trans("ContactsAddresses"), 0, 'contact');
if ($action == 'edit') {
    /*
     * Fiche en mode edition
     */
    print '<form name="perso" method="POST" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<input type="hidden" name="action" value="update">';
    print '<input type="hidden" name="id" value="' . $object->id . '">';
    print '<table class="border" width="100%">';
    // Ref
    print '<tr><td width="20%">' . $langs->trans("Ref") . '</td><td colspan="3">';
    print $object->id;
    print '</td></tr>';
    // Name
 /**
  *  Assign custom values for canvas
  *
  *  @param	string		&$action    	Type of action
  *  @param	int			$id				Id
  *  @return	void
  */
 function assign_values(&$action, $id)
 {
     global $conf, $db, $langs, $user;
     global $form;
     $ret = $this->getObject($id);
     parent::assign_values($action, $id);
     $this->tpl['title'] = $this->getTitle($action);
     $this->tpl['error'] = $this->error;
     $this->tpl['errors'] = $this->errors;
     if ($action == 'view') {
         // Card header
         $head = contact_prepare_head($this->object);
         $title = $this->getTitle($action);
         $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'contact');
         $this->tpl['showend'] = dol_get_fiche_end();
         $objsoc = new Societe($db);
         $objsoc->fetch($this->object->socid);
         $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1);
         $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
     } else {
         // Confirm delete contact
         if ($action == 'delete' && $user->rights->societe->contact->supprimer) {
             $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1);
         }
     }
     if ($action == 'list') {
         $this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
     }
 }
     dol_fiche_end();
     formCategory($db, $member, 3, 0, $user->rights->adherent->creer);
 }
 if ($type == 4) {
     $langs->load("contact");
     /*
      * Category card for contact
      */
     require_once DOL_DOCUMENT_ROOT . '/core/lib/contact.lib.php';
     require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
     // Produit
     $object = new Contact($db);
     $result = $object->fetch($id, $ref);
     $object->fetch_thirdparty();
     llxHeader("", "", $langs->trans("Contact"));
     $head = contact_prepare_head($object, $user);
     $titre = $langs->trans("ContactsAddresses");
     $picto = 'contact';
     dol_fiche_head($head, 'category', $titre, 0, $picto);
     $rowspan = 5;
     if (!empty($conf->societe->enabled)) {
         $rowspan++;
     }
     print '<table class="border" width="100%">';
     // Ref
     print '<tr><td width="20%">' . $langs->trans("Ref") . '</td>';
     print '<td class="valeur">';
     print $form->showrefnav($object, 'rowid');
     print '</td></tr>';
     // Name
     print '<tr><td width="20%">' . $langs->trans("Lastname") . ' / ' . $langs->trans("Label") . '</td><td width="30%">' . $object->lastname . '</td>';
	/**
	 *    Assign custom values for canvas
	 *    @param      action     Type of action
	 */
	function assign_values($action='')
	{
		global $conf, $db, $langs, $user;
		global $form;

		parent::assign_values($action);

        $this->tpl['title'] = $this->getTitle($action);
        $this->tpl['error'] = $this->error;
        $this->tpl['errors']= $this->errors;

		if ($action == 'view')
		{
            // Card header
            $head = contact_prepare_head($this->object);
            $title = $this->getTitle($action);

		    $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'contact');
		    $this->tpl['showend']=dol_get_fiche_end();

			// Confirm delete contact
        	if ($user->rights->societe->contact->supprimer)
        	{
        		if ($_GET["action"] == 'delete')
        		{
        			$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1);
        		}
        	}

        	$objsoc = new Societe($db);
            $objsoc->fetch($this->object->fk_soc);

            $this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1);

            $this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1);
		}
	}