Example #1
0
    print '<tr '.$bc[$var].'><td id="label">'.$langs->trans("Country").'</td><td id="value" nowrap="nowrap">';
    $img=picto_from_langcode($soc->country_code);
    if ($soc->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$soc->pays,$langs->trans("CountryIsInEEC"),1,0);
    else print ($img?$img.' ':'').$soc->country;
    print '</td>';
        
    // MAP GPS
    if($conf->map->enabled)
        print '<td id="label" colspan="2">GPS '.img_picto(($soc->lat.','.$soc->lng),(($soc->lat && $soc->lng)?"statut4":"statut1")).'</td></tr>';
    else
        print '<td id="label" colspan="2"></td></tr>';
    $var=!$var;


	print '<tr '.$bc[$var].'><td id="label">'.$langs->trans('Phone').'</td><td id="value">'.dol_print_phone($soc->tel,$soc->pays_code,0,$soc->id,'AC_TEL').'</td>';
	print '<td id="label">'.$langs->trans('Fax').'</td><td id="value">'.dol_print_phone($soc->fax,$soc->pays_code,0,$soc->id,'AC_FAX').'</td></tr>';
        $var=!$var;

	// EMail
	print '<tr '.$bc[$var].'><td id="label">'.$langs->trans('EMail').'</td><td id="value">';
	print dol_print_email($soc->email,0,$soc->id,'AC_EMAIL');
	print '</td>';

	// Web
	print '<td id="label">'.$langs->trans('Web').'</td><td id="value">';
	print dol_print_url($soc->url);
	print '</td></tr>';
        $var=!$var;

	print '</table>';
        print '</td>';
    $img = picto_from_langcode($soc->country_code);
    print $img ? $img . ' ' : '';
    print $soc->country;
    print '</td></tr>';
}
// EMail
print '<tr><td>' . $langs->trans('EMail') . '</td><td colspan="3">';
print dol_print_email($soc->email, 0, $soc->id, 'AC_EMAIL');
print '</td></tr>';
// Web
print '<tr><td>' . $langs->trans('Web') . '</td><td colspan="3">';
print dol_print_url($soc->url);
print '</td></tr>';
// Phone / Fax
print '<tr><td>' . $langs->trans('Phone') . '</td><td>' . dol_print_phone($soc->tel, $soc->country_code, 0, $soc->id, 'AC_TEL') . '</td>';
print '<td>' . $langs->trans('Fax') . '</td><td>' . dol_print_phone($soc->fax, $soc->country_code, 0, $soc->id, 'AC_FAX') . '</td></tr>';
print '</table>';
print '</div>';
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
    $prodcustprice = new Productcustomerprice($db);
    $sortfield = GETPOST("sortfield", 'alpha');
    $sortorder = GETPOST("sortorder", 'alpha');
    $page = GETPOST("page", 'int');
    if ($page == -1) {
        $page = 0;
    }
    $offset = $conf->liste_limit * $page;
    $pageprev = $page - 1;
    $pagenext = $page + 1;
    if (!$sortorder) {
        $sortorder = "ASC";
Example #3
0
 print $contact->ville . '</td></tr>';
 // Country
 print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
 $img = picto_from_langcode($contact->pays_code);
 if ($img) {
     print $img . ' ';
 }
 print $contact->pays;
 print '</td></tr>';
 // Department
 print '<tr><td>' . $langs->trans('State') . '</td><td colspan="3">' . $contact->departement . '</td>';
 // Phone
 print '<tr><td>' . $langs->trans("PhonePro") . '</td><td>' . dol_print_phone($contact->phone_pro, $contact->pays_code, $contact->id, $contact->socid, 'AC_TEL') . '</td>';
 print '<td>' . $langs->trans("PhonePerso") . '</td><td>' . dol_print_phone($contact->phone_perso, $contact->pays_code, $contact->id, $contact->socid, 'AC_TEL') . '</td></tr>';
 print '<tr><td>' . $langs->trans("PhoneMobile") . '</td><td>' . dol_print_phone($contact->phone_mobile, $contact->pays_code, $contact->id, $contact->socid, 'AC_TEL') . '</td>';
 print '<td>' . $langs->trans("Fax") . '</td><td>' . dol_print_phone($contact->fax, $contact->pays_code, $contact->id, $contact->socid, 'AC_FAX') . '</td></tr>';
 // Email
 print '<tr><td>' . $langs->trans("EMail") . '</td><td>' . dol_print_email($contact->email, $contact->id, $contact->socid, 'AC_EMAIL') . '</td>';
 if ($conf->mailing->enabled) {
     $langs->load("mails");
     print '<td nowrap>' . $langs->trans("NbOfEMailingsReceived") . '</td>';
     print '<td><a href="' . DOL_URL_ROOT . '/comm/mailing/liste.php?filteremail=' . urlencode($contact->email) . '">' . $contact->getNbOfEMailings() . '</a></td>';
 } else {
     print '<td colspan="2">&nbsp;</td>';
 }
 print '</tr>';
 print '</table>';
 print '</div>';
 if ($mesg) {
     print $mesg;
 }
Example #4
0
	/**
	 * return div with list of information content block (see extrafields block)
	 * 
	 *  @param  int	    $blockid	    id of the block in the extrafiels block attribute
	 *  @return	@string
	 */
	function content_box($blockid) {
		global $conf, $user, $langs;

		// List of tel, fax, mail...
		$rtr = '<div class="row vcard sepH_b">';
		$rtr.= '<table class="display noborder">';
		$rtr.= '<tbody>';

		// list tel, fax, mail
		for ($i = 0; $i < count($this->fk_extrafields->place[$blockid]); $i++) { // Block
			foreach ($this->fk_extrafields->place[$blockid][$i] as $key) {
				$aRow = $this->fk_extrafields->fields->$key;
				if (is_object($aRow) && $aRow->enable) {
					$rtr.='<tr>';
					$label = (empty($aRow->label) ? $langs->trans($key) : $langs->trans($aRow->label));
					if (isset($aRow->ico))
						$rtr.= '<td><img src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/ico/' . $aRow->ico . '.png" title="' . $label . '" /></td>';
					else
						$rtr.= '<td><img src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/ico/icSw2/16-Money.png" title="' . $label . '" /></td>';

					if ($aRow->type == "AC_EMAIL")
						$rtr.= '<td class="s_color">' . $label . '</td></td><td class="ttip_r edit_text">' . $this->$key . '</td>';
					elseif ($aRow->type == "AC_TEL" || $aRow->type == "AC_FAX")
						$rtr.= '<td class="s_color">' . $label . '</td><td class="ttip_r edit_text">' . dol_print_phone($this->$key, $this->Country, 0, $this->id(), $aRow->type) . '</td>';
					elseif ($aRow->type == "AC_URL") {
						$rtr.= '<td>' . dol_print_url($label, $this->$key->value) . '</td><td class="ttip_r edit_text">' . $this->$key . '</td>';
					}
					else
						$rtr.= '<td class="s_color">' . $label . '</td><td class="ttip_r edit_text">' . $this->$key . '</td>';

					$rtr.='</tr>';
				}
			}
		}

		$rtr.= '</tbody>';
		$rtr.= '</table>';

		$rtr.= '</div>';

		return $rtr;
	}
Example #5
0
 // Third party - Contact
 if ($conf->societe->enabled) {
     print '<tr><td width="30%">' . $langs->trans("ActionOnCompany") . '</td><td>' . ($object->thirdparty->id ? $object->thirdparty->getNomUrl(1) : $langs->trans("None"));
     if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') {
         if ($object->thirdparty->fetch($object->thirdparty->id)) {
             print "<br>" . dol_print_phone($object->thirdparty->phone);
         }
     }
     print '</td>';
     print '<td>' . $langs->trans("Contact") . '</td>';
     print '<td>';
     if ($object->contactid > 0) {
         print $object->contact->getNomUrl(1);
         if ($object->contactid && $object->type_code == 'AC_TEL') {
             if ($object->contact->fetch($object->contactid)) {
                 print "<br>" . dol_print_phone($object->contact->phone_pro);
             }
         }
     } else {
         print $langs->trans("None");
     }
     print '</td></tr>';
 }
 // Project
 if (!empty($conf->projet->enabled)) {
     print '<tr><td width="30%">' . $langs->trans("Project") . '</td><td colspan="3">';
     if ($object->fk_project) {
         $project = new Project($db);
         $project->fetch($object->fk_project);
         print $project->getNomUrl(1, '', 1);
     }
Example #6
0
 }
 // Phone
 if (!empty($arrayfields['p.phone']['checked'])) {
     print '<td>' . dol_print_phone($obj->phone_pro, $obj->country_code, $obj->cidp, $obj->socid, 'AC_TEL') . '</td>';
 }
 // Phone perso
 if (!empty($arrayfields['p.phone_perso']['checked'])) {
     print '<td>' . dol_print_phone($obj->phone_perso, $obj->country_code, $obj->cidp, $obj->socid, 'AC_TEL') . '</td>';
 }
 // Phone mobile
 if (!empty($arrayfields['p.phone_mobile']['checked'])) {
     print '<td>' . dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->cidp, $obj->socid, 'AC_TEL') . '</td>';
 }
 // Fax
 if (!empty($arrayfields['p.fax']['checked'])) {
     print '<td>' . dol_print_phone($obj->fax, $obj->country_code, $obj->cidp, $obj->socid, 'AC_TEL') . '</td>';
 }
 // EMail
 if (!empty($arrayfields['p.email']['checked'])) {
     print '<td>' . dol_print_email($obj->email, $obj->cidp, $obj->socid, 'AC_EMAIL', 18) . '</td>';
 }
 // Skype
 if (!empty($arrayfields['p.skype']['checked'])) {
     if (!empty($conf->skype->enabled)) {
         print '<td>' . dol_print_skype($obj->skype, $obj->cidp, $obj->socid, 'AC_SKYPE', 18) . '</td>';
     }
 }
 // Company
 if (!empty($arrayfields['p.thirdparty']['checked'])) {
     print '<td>';
     if ($obj->socid) {
Example #7
0
     } else {
         print $html->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"));
     }
 }
 print '</td></tr>' . "\n";
 // Tel pro
 print '<tr><td valign="top">' . $langs->trans("PhonePro") . '</td>';
 print '<td>' . dol_print_phone($fuser->office_phone, '', 0, 0, 1) . '</td>';
 print '</tr>' . "\n";
 // Tel mobile
 print '<tr><td valign="top">' . $langs->trans("PhoneMobile") . '</td>';
 print '<td>' . dol_print_phone($fuser->user_mobile, '', 0, 0, 1) . '</td>';
 print '</tr>' . "\n";
 // Fax
 print '<tr><td valign="top">' . $langs->trans("Fax") . '</td>';
 print '<td>' . dol_print_phone($fuser->office_fax, '', 0, 0, 1) . '</td>';
 print '</tr>' . "\n";
 // EMail
 print '<tr><td valign="top">' . $langs->trans("EMail") . '</td>';
 print '<td>' . dol_print_email($fuser->email, 0, 0, 1) . '</td>';
 print "</tr>\n";
 // Signature
 print '<tr><td valign="top">' . $langs->trans('Signature') . '</td>';
 print '<td>' . $fuser->signature . '</td>';
 print "</tr>\n";
 // Statut
 print '<tr><td valign="top">' . $langs->trans("Status") . '</td>';
 print '<td>';
 print $fuser->getLibStatut(4);
 print '</td>';
 print '</tr>' . "\n";
print '</form><br><br>';
if (!empty($conf->global->CLICKTODIAL_URL)) {
    $user->fetch_clicktodial();
    $phonefortest = $mysoc->phone;
    if (GETPOST('phonefortest')) {
        $phonefortest = GETPOST('phonefortest');
    }
    print '<form action="' . $_SERVER["PHP_SELF"] . '">';
    print $langs->trans("LinkToTestClickToDial", $user->login) . ' : ';
    print '<input class="flat" type="text" name="phonefortest" value="' . dol_escape_htmltag($phonefortest) . '">';
    print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans("RefreshPhoneLink")) . '">';
    print '</form>';
    $setupcomplete = 1;
    if (preg_match('/__LOGIN__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) {
        $setupcomplete = 0;
    }
    if (preg_match('/__PASSWORD__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) {
        $setupcomplete = 0;
    }
    if (preg_match('/__PHONEFROM__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) {
        $setupcomplete = 0;
    }
    if ($setupcomplete) {
        print $langs->trans("LinkToTest", $user->login) . ': ' . dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL');
    } else {
        $langs->load("errors");
        print '<div class="warning">' . $langs->trans("WarningClickToDialUserSetupNotComplete") . '</div>';
    }
}
llxFooter();
$db->close();
Example #9
0
 print '<tr ' . $bc[$var] . '><td>' . $langs->trans("State") . '</td><td>';
 if ($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT) {
     print getState($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT);
 } else {
     print '&nbsp;';
 }
 print '</td></tr>';
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("CompanyCurrency") . '</td><td>';
 print currency_name($conf->currency, 1);
 print ' (' . getCurrencySymbol($conf->currency) . ')';
 print '</td></tr>';
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Tel") . '</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL, $mysoc->country_code) . '</td></tr>';
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Fax") . '</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX, $mysoc->country_code) . '</td></tr>';
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Mail") . '</td><td>' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL, 0, 0, 0, 80) . '</td></tr>';
 // Web
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Web") . '</td><td>' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB, '_blank', 80) . '</td></tr>';
 // Barcode
 if (!empty($conf->barcode->enabled)) {
     $var = !$var;
     print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Gencod") . '</td><td>' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '</td></tr>';
 }
 // Logo
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Logo") . '</td><td>';
 print '<table width="100%" class="nocellnopadd"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
 print $mysoc->logo;
Example #10
0
 // Country
 print '<tr><td>' . $langs->trans("Country") . '</td><td class="valeur">';
 $img = picto_from_langcode($object->country_code);
 if ($img) {
     print $img . ' ';
 }
 print getCountry($object->country_code);
 print '</td></tr>';
 // State
 print '<tr><td>' . $langs->trans('State') . '</td><td class="valeur">' . $object->state . '</td>';
 // Tel pro.
 print '<tr><td>' . $langs->trans("PhonePro") . '</td><td class="valeur">' . dol_print_phone($object->phone, $object->country_code, 0, $object->fk_soc, 1) . '</td></tr>';
 // Tel perso
 print '<tr><td>' . $langs->trans("PhonePerso") . '</td><td class="valeur">' . dol_print_phone($object->phone_perso, $object->country_code, 0, $object->fk_soc, 1) . '</td></tr>';
 // Tel mobile
 print '<tr><td>' . $langs->trans("PhoneMobile") . '</td><td class="valeur">' . dol_print_phone($object->phone_mobile, $object->country_code, 0, $object->fk_soc, 1) . '</td></tr>';
 // Skype
 if (!empty($conf->skype->enabled)) {
     print '<tr><td>' . $langs->trans("Skype") . '</td><td class="valeur">' . dol_print_skype($object->skype, 0, $object->fk_soc, 1) . '</td></tr>';
 }
 // Birthday
 print '<tr><td>' . $langs->trans("Birthday") . '</td><td class="valeur">' . dol_print_date($object->birth, 'day') . '</td></tr>';
 // Public
 print '<tr><td>' . $langs->trans("Public") . '</td><td class="valeur">' . yn($object->public) . '</td></tr>';
 // Status
 print '<tr><td>' . $langs->trans("Status") . '</td><td class="valeur">' . $object->getLibStatut(4) . '</td></tr>';
 // Categories
 if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
     print '<tr><td>' . $langs->trans("Categories") . '</td>';
     print '<td colspan="2">';
     print $form->showCategories($object->id, 'member', 1);
Example #11
0
            print '</td>';
        }

        if ($view == 'phone')
        {
            // Phone
            print '<td>'.dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
            // Phone mobile
            print '<td>'.dol_print_phone($obj->phone_mobile,$obj->pays_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
            // Fax
            print '<td>'.dol_print_phone($obj->fax,$obj->pays_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
        }
        else
        {
            // Phone
            print '<td>'.dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
            // EMail
            print '<td>'.dol_print_email($obj->email,$obj->cidp,$obj->socid,'AC_EMAIL',18).'</td>';
        }

		// Date
		print '<td align="center">'.dol_print_date($db->jdate($obj->tms),"day").'</td>';

		// Private/Public
		print '<td align="center">'.$contactstatic->LibPubPriv($obj->priv).'</td>';

		// Links Add action and Export vcard
        print '<td align="right">';
        print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&amp;backtopage=1&amp;contactid='.$obj->cidp.'&amp;socid='.$obj->socid.'">'.img_object($langs->trans("AddAction"),"action").'</a>';
        print ' &nbsp; ';
        print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$obj->cidp.'">';
Example #12
0
	$img=picto_from_langcode($adh->pays_code);
	if ($img) print $img.' ';
    print getCountry($adh->pays_code);
    print '</td></tr>';

	// State
	print '<tr><td>'.$langs->trans('State').'</td><td class="valeur">'.$adh->departement.'</td>';

    // Tel pro.
    print '<tr><td>'.$langs->trans("PhonePro").'</td><td class="valeur">'.dol_print_phone($adh->phone,$adh->pays_code,0,$adh->fk_soc,1).'</td></tr>';

    // Tel perso
    print '<tr><td>'.$langs->trans("PhonePerso").'</td><td class="valeur">'.dol_print_phone($adh->phone_perso,$adh->pays_code,0,$adh->fk_soc,1).'</td></tr>';

    // Tel mobile
    print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.dol_print_phone($adh->phone_mobile,$adh->pays_code,0,$adh->fk_soc,1).'</td></tr>';

    // EMail
    print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($adh->email,0,$adh->fk_soc,1).'</td></tr>';

	// Date naissance
    print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($adh->naiss,'day').'</td></tr>';

    // Public
    print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($adh->public).'</td></tr>';

    // Status
    print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut(4).'</td></tr>';

    // Other attributes
    foreach($extrafields->attribute_label as $key=>$label)
Example #13
0
 print "</td></tr>";
 // Zip / Town
 print '<tr><td nowrap="nowrap">' . $langs->trans('Zip') . ' / ' . $langs->trans("Town") . '</td><td colspan="3">' . $object->zip . ($object->zip && $object->town ? ' / ' : '') . $societe->town . '</td>';
 print '</tr>';
 // Country
 print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
 $img = picto_from_langcode($object->country_code);
 if ($object->isInEEC()) {
     print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
 } else {
     print ($img ? $img . ' ' : '') . $object->country;
 }
 print '</td></tr>';
 // Phone
 print '<tr><td>' . $langs->trans("Phone") . '</td><td style="min-width: 25%;">' . dol_print_phone($object->tel, $object->country_code, 0, $object->id, 'AC_TEL') . '</td>';
 print '<td>' . $langs->trans("Fax") . '</td><td style="min-width: 25%;">' . dol_print_phone($object->fax, $object->country_code) . '</td></tr>';
 // EMail
 print '<td>' . $langs->trans('EMail') . '</td><td colspan="3">' . dol_print_email($object->email, 0, $object->id, 'AC_EMAIL') . '</td></tr>';
 // Web
 print '<tr><td>' . $langs->trans("Web") . "</td><td colspan=\"3\"><a href=\"http://{$object->url}\">{$object->url}</a></td></tr>";
 // Level of prospect
 print '<tr><td nowrap>';
 print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
 print $langs->trans('ProspectLevelShort');
 print '<td>';
 if ($_GET['action'] != 'editlevel' && $user->rights->societe->creer) {
     print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editlevel&amp;socid=' . $object->id . '">' . img_edit($langs->trans('SetLevel'), 1) . '</a></td>';
 }
 print '</tr></table>';
 print '</td><td colspan="3">';
 if ($_GET['action'] == 'editlevel') {
Example #14
0
			print '<table class="border" width="100%">';

			print '<tr><td width="20%">'.$langs->trans('AddressLabel').'</td><td colspan="3">'.$address->lines[$i]->label.'</td>';
			print '<td valign="top" colspan="2" width="50%" rowspan="6">'.$langs->trans('Note').' :<br>'.nl2br($address->lines[$i]->note).'</td></tr>';
			print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$address->lines[$i]->name.'</td></tr>';

			print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($address->lines[$i]->address)."</td></tr>";

			print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$address->lines[$i]->cp."</td></tr>";
			print '<tr><td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$address->lines[$i]->ville."</td></tr>";

			print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$address->lines[$i]->pays.'</td>';

			print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($address->lines[$i]->tel,$address->lines[$i]->pays_code,0,$address->socid,'AC_TEL').'</td></tr>';

      		print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($address->lines[$i]->fax,$address->lines[$i]->pays_code,0,$address->socid,'AC_FAX').'</td></tr>';

			print '</td></tr>';

			print '</table>';


			/*
			*
			*/

			print '<div class="tabsAction">';

			if ($user->rights->societe->creer)
			{
				print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$address->socid.'&amp;id='.$address->lines[$i]->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
Example #15
0
function dolibarr_print_phone($phone, $country = "FR", $cid = 0, $socid = 0, $addlink = 0, $separ = "&nbsp;")
{
    return dol_print_phone($phone, $country, $cid, $socid, $addlink, $separ);
}
Example #16
0
 if ($object->ldap_sid) {
     print '<tr><td valign="top">' . $langs->trans("Type") . '</td><td colspan="2">';
     print $langs->trans("DomainUser", $ldap->domainFQDN);
     print '</td></tr>' . "\n";
 }
 // Tel pro
 print '<tr><td valign="top">' . $langs->trans("PhonePro") . '</td>';
 print '<td colspan="2">' . dol_print_phone($object->office_phone, '', 0, 0, 1) . '</td>';
 print '</tr>' . "\n";
 // Tel mobile
 print '<tr><td valign="top">' . $langs->trans("PhoneMobile") . '</td>';
 print '<td colspan="2">' . dol_print_phone($object->user_mobile, '', 0, 0, 1) . '</td>';
 print '</tr>' . "\n";
 // Fax
 print '<tr><td valign="top">' . $langs->trans("Fax") . '</td>';
 print '<td colspan="2">' . dol_print_phone($object->office_fax, '', 0, 0, 1) . '</td>';
 print '</tr>' . "\n";
 // Skype
 if (!empty($conf->skype->enabled)) {
     print '<tr><td valign="top">' . $langs->trans("Skype") . '</td>';
     print '<td colspan="2">' . dol_print_skype($object->skype, 0, 0, 1) . '</td>';
     print "</tr>\n";
 }
 // EMail
 print '<tr><td valign="top">' . $langs->trans("EMail") . '</td>';
 print '<td colspan="2">' . dol_print_email($object->email, 0, 0, 1) . '</td>';
 print "</tr>\n";
 // Signature
 print '<tr><td valign="top">' . $langs->trans('Signature') . '</td><td colspan="2">';
 print dol_htmlentitiesbr($object->signature);
 print "</td></tr>\n";
Example #17
0
 print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
 $img = picto_from_langcode($object->country_code);
 if ($img) {
     print $img . ' ';
 }
 print $object->country;
 print '</td></tr>';
 // State
 if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
     print '<tr><td>' . $langs->trans('State') . '</td><td colspan="3">' . $object->state . '</td>';
 }
 // Phone
 print '<tr><td>' . $langs->trans("PhonePro") . '</td><td>' . dol_print_phone($object->phone_pro, $object->country_code, $object->id, $object->socid, 'AC_TEL') . '</td>';
 print '<td>' . $langs->trans("PhonePerso") . '</td><td>' . dol_print_phone($object->phone_perso, $object->country_code, $object->id, $object->socid, 'AC_TEL') . '</td></tr>';
 print '<tr><td>' . $langs->trans("PhoneMobile") . '</td><td>' . dol_print_phone($object->phone_mobile, $object->country_code, $object->id, $object->socid, 'AC_TEL') . '</td>';
 print '<td>' . $langs->trans("Fax") . '</td><td>' . dol_print_phone($object->fax, $object->country_code, $object->id, $object->socid, 'AC_FAX') . '</td></tr>';
 // Email
 print '<tr><td>' . $langs->trans("EMail") . '</td><td>' . dol_print_email($object->email, $object->id, $object->socid, 'AC_EMAIL') . '</td>';
 if (!empty($conf->mailing->enabled)) {
     $langs->load("mails");
     print '<td class="nowrap">' . $langs->trans("NbOfEMailingsSend") . '</td>';
     print '<td><a href="' . DOL_URL_ROOT . '/comm/mailing/list.php?filteremail=' . urlencode($object->email) . '">' . $object->getNbOfEMailings() . '</a></td>';
 } else {
     print '<td colspan="2">&nbsp;</td>';
 }
 print '</tr>';
 // Instant message and no email
 print '<tr><td>' . $langs->trans("IM") . '</td><td>' . $object->jabberid . '</td>';
 if (!empty($conf->mailing->enabled)) {
     print '<td>' . $langs->trans("No_Email") . '</td><td>' . yn($object->no_email) . '</td>';
 } else {
/**
 * 		Show html area for list of addresses
 *
 *		@param	Conf		$conf		Object conf
 * 		@param	Translate	$langs		Object langs
 * 		@param	DoliDB		$db			Database handler
 * 		@param	Object		$object		Third party object
 *      @param  string		$backtopage	Url to go once address is created
 *      @return	void
 */
function show_addresses($conf, $langs, $db, $object, $backtopage = '')
{
    global $user;
    global $bc;
    require_once DOL_DOCUMENT_ROOT . '/societe/class/address.class.php';
    $addressstatic = new Address($db);
    $num = $addressstatic->fetch_lines($object->id);
    $buttoncreate = '';
    if ($user->rights->societe->creer) {
        $buttoncreate = '<a class="addnewrecord" href="' . DOL_URL_ROOT . '/comm/address.php?socid=' . $object->id . '&amp;action=create&amp;backtopage=' . urlencode($backtopage) . '">' . $langs->trans("AddAddress") . ' ' . img_picto($langs->trans("AddAddress"), 'filenew') . '</a>' . "\n";
    }
    print "\n";
    print_fiche_titre($langs->trans("AddressesForCompany"), $buttoncreate, '');
    print "\n" . '<table class="noborder" width="100%">' . "\n";
    print '<tr class="liste_titre"><td>' . $langs->trans("Label") . '</td>';
    print '<td>' . $langs->trans("CompanyName") . '</td>';
    print '<td>' . $langs->trans("Town") . '</td>';
    print '<td>' . $langs->trans("Country") . '</td>';
    print '<td>' . $langs->trans("Phone") . '</td>';
    print '<td>' . $langs->trans("Fax") . '</td>';
    print "<td>&nbsp;</td>";
    print "</tr>";
    if ($num > 0) {
        $var = true;
        foreach ($addressstatic->lines as $address) {
            $var = !$var;
            print "<tr " . $bc[$var] . ">";
            print '<td>';
            $addressstatic->id = $address->id;
            $addressstatic->label = $address->label;
            print $addressstatic->getNomUrl(1);
            print '</td>';
            print '<td>' . $address->name . '</td>';
            print '<td>' . $address->town . '</td>';
            $img = picto_from_langcode($address->country_code);
            print '<td>' . ($img ? $img . ' ' : '') . $address->country . '</td>';
            // Lien click to dial
            print '<td>';
            print dol_print_phone($address->phone, $address->country_code, $address->id, $object->id, 'AC_TEL');
            print '</td>';
            print '<td>';
            print dol_print_phone($address->fax, $address->country_code, $address->id, $object->id, 'AC_FAX');
            print '</td>';
            if ($user->rights->societe->creer) {
                print '<td align="right">';
                print '<a href="' . DOL_URL_ROOT . '/comm/address.php?action=edit&amp;id=' . $address->id . '&amp;socid=' . $object->id . '&amp;backtopage=' . urlencode($backtopage) . '">';
                print img_edit();
                print '</a></td>';
            }
            print "</tr>\n";
        }
    } else {
        //print "<tr ".$bc[$var].">";
        //print '<td>'.$langs->trans("NoAddressYetDefined").'</td>';
        //print "</tr>\n";
    }
    print "\n</table>\n";
    print "<br>\n";
    return $num;
}
Example #19
0
    {
      $obj = $db->fetch_object($resql);

      $var=!$var;

      print "<tr $bc[$var]>";
      print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowContact"),"contact");
      print '</a>&nbsp;<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.$obj->name.'</a></td>';
      print "<td>$obj->firstname</TD>";

      print '<td><a href="'.$_SERVER["PHP_SELF"].'?type='.$type.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").'</a>&nbsp;';
      print "<a href=\"".$urlfiche."?socid=".$obj->rowid."\">$obj->nom</a></td>\n";

      print '<td>'.dol_print_phone($obj->email,$obj->cidp,$obj->rowid,'AC_EMAIL').'</td>';

      print '<td>'.dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->rowid,'AC_TEL').'&nbsp;</td>';

      print "</tr>\n";
      $i++;
    }
  	print "</table></p>";
  	$db->free($resql);
}
else
{
    dol_print_error($db);
}

$db->close();

llxFooter('$Date: 2011/08/03 00:46:26 $ - $Revision: 1.50 $');
Example #20
0
	// Zip / Town
	print '<tr><td nowrap="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$societe->cp.(($societe->cp && $societe->ville)?' / ':'').$societe->ville.'</td>';
	print '</tr>';

	// Country
	print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
	$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 '</td></tr>';

	// Phone
	print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($societe->tel,$societe->pays_code,0,$societe->id,'AC_TEL').'</td>';

	// Fax
	print '<td>'.$langs->trans("Fax").'</td><td style="min-width: 25%;">'.dol_print_phone($societe->fax,$societe->pays_code,0,$societe->id,'AC_FAX').'</td></tr>';

    // EMail
	print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($societe->email,0,$societe->id,'AC_EMAIL').'</td></tr>';

	// Web
	print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\">".dol_print_url($societe->url)."</td></tr>";

	// Assujetti a TVA ou pas
	print '<tr>';
	print '<td nowrap="nowrap">'.$langs->trans('VATIsUsed').'</td><td colspan="3">';
	print yn($societe->tva_assuj);
	print '</td>';
	print '</tr>';

	// Local Taxes
 if ($action == 'delete') {
     print $form->formconfirm($_SERVER['PHP_SELF'] . "?socid=" . $object->socid . "&amp;id=" . $id, $langs->trans("DeleteAddress"), $langs->trans("ConfirmDeleteAddress"), "confirm_delete");
 }
 $nblines = count($object->lines);
 if ($nblines) {
     for ($i = 0; $i < $nblines; $i++) {
         print '<table class="border" width="100%">';
         print '<tr><td width="20%">' . $langs->trans('AddressLabel') . '</td><td colspan="3">' . $object->lines[$i]->label . '</td>';
         print '<td valign="top" colspan="2" width="50%" rowspan="6">' . $langs->trans('Note') . ' :<br>' . nl2br($object->lines[$i]->note) . '</td></tr>';
         print '<tr><td width="20%">' . $langs->trans('Name') . '</td><td colspan="3">' . $object->lines[$i]->name . '</td></tr>';
         print "<tr><td valign=\"top\">" . $langs->trans('Address') . "</td><td colspan=\"3\">" . nl2br($object->lines[$i]->address) . "</td></tr>";
         print '<tr><td width="25%">' . $langs->trans('Zip') . '</td><td width="25%">' . $object->lines[$i]->zip . "</td></tr>";
         print '<tr><td width="25%">' . $langs->trans('Town') . '</td><td width="25%">' . $object->lines[$i]->town . "</td></tr>";
         print '<tr><td>' . $langs->trans('Country') . '</td><td colspan="3">' . $object->lines[$i]->country . '</td>';
         print '<tr><td>' . $langs->trans('Phone') . '</td><td>' . dol_print_phone($object->lines[$i]->phone, $object->lines[$i]->country_code, 0, $object->socid, 'AC_TEL') . '</td></tr>';
         print '<tr><td>' . $langs->trans('Fax') . '</td><td>' . dol_print_phone($object->lines[$i]->fax, $object->lines[$i]->country_code, 0, $object->socid, 'AC_FAX') . '</td></tr>';
         print '</td></tr>';
         print '</table>';
         /*
          *
          */
         print '<div class="tabsAction">';
         if ($user->rights->societe->creer) {
             print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid . '&amp;id=' . $object->lines[$i]->id . '&amp;action=edit">' . $langs->trans("Modify") . '</a></div>';
         }
         if ($user->rights->societe->supprimer) {
             print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid . '&amp;id=' . $object->lines[$i]->id . '&amp;action=delete">' . $langs->trans("Delete") . '</a></div>';
         }
         print '</div>';
         print '<br>';
     }
Example #22
0
 /**
  * 	Return full address of contact
  *
  * 	@param		string		$htmlkey            HTML id to make banner content unique
  *  @param      Object      $object				Object (thirdparty, thirdparty of contact for contact, null for a member)
  *	@return		string							Full address string
  */
 function getBannerAddress($htmlkey, $object)
 {
     global $conf, $langs;
     $countriesusingstate = array('AU', 'US', 'IN', 'GB', 'ES', 'UK', 'TR');
     $contactid = 0;
     $thirdpartyid = 0;
     if ($this->element == 'societe') {
         $thirdpartyid = $this->id;
     }
     if ($this->element == 'contact') {
         $contactid = $this->id;
         $thirdpartyid = $object->fk_soc;
     }
     if ($this->element == 'user') {
         $contactid = $this->contact_id;
         $thirdpartyid = $object->fk_soc;
     }
     $out = '<!-- BEGIN part to show address block -->';
     $outdone = 0;
     $coords = $this->getFullAddress(1, ', ');
     if ($coords) {
         if (!empty($conf->use_javascript_ajax)) {
             $namecoords = $this->getFullName($langs, 1) . '<br>' . $coords;
             // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
             $out .= '<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\'' . dol_escape_js($namecoords) . '\',\'' . dol_escape_js($langs->trans("HelpCopyToClipboard")) . '\');">';
             $out .= img_picto($langs->trans("Address"), 'object_address.png');
             $out .= '</a> ';
         }
         $out .= dol_print_address($coords, 'address_' . $htmlkey . '_' . $this->id, $this->element, $this->id, 1);
         $outdone++;
         $outdone++;
     }
     if (!in_array($this->country_code, $countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) && !empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) {
         $out .= ($outdone ? '<br>' : '') . $this->state;
         $outdone++;
     }
     if (!empty($this->phone_pro) || !empty($this->phone_mobile) || !empty($this->phone_perso) || !empty($this->fax) || !empty($this->office_phone) || !empty($this->user_mobile) || !empty($this->office_fax)) {
         $out .= $outdone ? '<br>' : '';
     }
     if (!empty($this->phone) && empty($this->phone_pro)) {
         // For objects that store pro phone into ->phone
         $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', '&nbsp;', 'phone', $langs->trans("PhonePro"));
         $outdone++;
     }
     if (!empty($this->phone_pro)) {
         $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', '&nbsp;', 'phone', $langs->trans("PhonePro"));
         $outdone++;
     }
     if (!empty($this->phone_mobile)) {
         $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', '&nbsp;', 'phone', $langs->trans("PhoneMobile"));
         $outdone++;
     }
     if (!empty($this->phone_perso)) {
         $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', '&nbsp;', 'phone', $langs->trans("PhonePerso"));
         $outdone++;
     }
     if (!empty($this->fax)) {
         $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', '&nbsp;', 'fax', $langs->trans("Fax"));
         $outdone++;
     }
     if (!empty($this->office_phone)) {
         $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', '&nbsp;', 'phone', $langs->trans("PhonePro"));
         $outdone++;
     }
     if (!empty($this->user_mobile)) {
         $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', '&nbsp;', 'phone', $langs->trans("PhoneMobile"));
         $outdone++;
     }
     if (!empty($this->office_fax)) {
         $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', '&nbsp;', 'fax', $langs->trans("Fax"));
         $outdone++;
     }
     $out .= '<div style="clear: both;"></div>';
     $outdone = 0;
     if (!empty($this->email)) {
         $out .= dol_print_email($this->email, $this->id, $object->id, 'AC_EMAIL', 0, 0, 1);
         $outdone++;
     }
     if (!empty($this->url)) {
         $out .= dol_print_url($this->url, '', 0, 1);
         $outdone++;
     }
     if (!empty($conf->skype->enabled)) {
         $out .= '<div style="clear: both;"></div>';
         if ($this->skype) {
             $out .= dol_print_skype($this->skype, $this->id, $object->id, 'AC_SKYPE');
         }
         $outdone++;
     }
     $out .= '<!-- END Part to show address block -->';
     return $out;
 }
    /**
     *    Assign custom values for canvas (for example into this->tpl to be used by templates)
     *
     *    @param	string	$action    Type of action
     *    @param	string	$id			Id of object
     *    @param	string	$ref		Ref of object
     *    @return	void
     */
    function assign_values(&$action, $id = 0, $ref = '')
    {
        global $conf, $langs, $user, $mysoc, $canvas;
        global $form, $formadmin, $formcompany;
        if ($action == 'add' || $action == 'update') {
            $this->assign_post($action);
        }
        if ($_GET["type"] == 'f') {
            $this->object->fournisseur = 1;
        }
        if ($_GET["type"] == 'c') {
            $this->object->client = 1;
        }
        if ($_GET["type"] == 'p') {
            $this->object->client = 2;
        }
        if ($_GET["type"] == 'cp') {
            $this->object->client = 3;
        }
        if ($_REQUEST["private"] == 1) {
            $this->object->particulier = 1;
        }
        foreach ($this->object as $key => $value) {
            $this->tpl[$key] = $value;
        }
        $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors);
        if (is_array($GLOBALS['errors'])) {
            $this->tpl['error'] = get_htmloutput_mesg('', $GLOBALS['errors'], 'error');
        }
        if ($action == 'create') {
            if ($conf->use_javascript_ajax) {
                $this->tpl['ajax_selecttype'] = "\n" . '<script type="text/javascript" language="javascript">
				$(document).ready(function () {
		              $("#radiocompany").click(function() {
                            document.formsoc.action.value="create";
                            document.formsoc.canvas.value="company";
                            document.formsoc.private.value=0;
                            document.formsoc.submit();
		              });
		               $("#radioprivate").click(function() {
                            document.formsoc.action.value="create";
                            document.formsoc.canvas.value="individual";
                            document.formsoc.private.value=1;
                            document.formsoc.submit();
                      });
		          });
                </script>' . "\n";
            }
        }
        if ($action == 'create' || $action == 'edit') {
            if ($conf->use_javascript_ajax) {
                $this->tpl['ajax_selectcountry'] = "\n" . '<script type="text/javascript" language="javascript">
				$(document).ready(function () {
						$("#selectcountry_id").change(function() {
							document.formsoc.action.value="' . $action . '";
							document.formsoc.canvas.value="' . $canvas . '";
							document.formsoc.submit();
						});
					})
				</script>' . "\n";
            }
            // Load object modCodeClient
            $module = !empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard';
            if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
                $module = substr($module, 0, dol_strlen($module) - 4);
            }
            $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
            foreach ($dirsociete as $dirroot) {
                $res = dol_include_once($dirroot . $module . '.php');
                if ($res) {
                    break;
                }
            }
            $modCodeClient = new $module($db);
            $this->tpl['auto_customercode'] = $modCodeClient->code_auto;
            // We verified if the tag prefix is used
            if ($modCodeClient->code_auto) {
                $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
            }
            // TODO create a function
            $this->tpl['select_customertype'] = '<select class="flat" name="client">';
            $this->tpl['select_customertype'] .= '<option value="2"' . ($this->object->client == 2 ? ' selected="selected"' : '') . '>' . $langs->trans('Prospect') . '</option>';
            $this->tpl['select_customertype'] .= '<option value="3"' . ($this->object->client == 3 ? ' selected="selected"' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
            $this->tpl['select_customertype'] .= '<option value="1"' . ($this->object->client == 1 ? ' selected="selected"' : '') . '>' . $langs->trans('Customer') . '</option>';
            $this->tpl['select_customertype'] .= '<option value="0"' . ($this->object->client == 0 ? ' selected="selected"' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>';
            $this->tpl['select_customertype'] .= '</select>';
            // Customer
            $this->tpl['customercode'] = $this->object->code_client;
            if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) {
                $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object, 0);
            }
            $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable();
            $s = $modCodeClient->getToolTip($langs, $this->object, 0);
            $this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1);
            if (!empty($conf->fournisseur->enabled)) {
                $this->tpl['supplier_enabled'] = 1;
                // Load object modCodeFournisseur
                $module = $conf->global->SOCIETE_CODECLIENT_ADDON;
                if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
                    $module = substr($module, 0, dol_strlen($module) - 4);
                }
                $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
                foreach ($dirsociete as $dirroot) {
                    $res = dol_include_once($dirroot . $module . '.php');
                    if ($res) {
                        break;
                    }
                }
                $modCodeFournisseur = new $module();
                $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto;
                // We verified if the tag prefix is used
                if ($modCodeFournisseur->code_auto) {
                    $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed();
                }
                // Supplier
                $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur", $this->object->fournisseur, 1);
                $this->tpl['suppliercode'] = $this->object->code_fournisseur;
                if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) {
                    $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object, 1);
                }
                $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable();
                $s = $modCodeFournisseur->getToolTip($langs, $this->object, 1);
                $this->tpl['help_suppliercode'] = $form->textwithpicto('', $s, 1);
                $this->object->LoadSupplierCateg();
                $this->tpl['suppliercategory'] = $this->object->SupplierCategories;
            }
            // Zip
            $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
            // Town
            $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
            // Country
            $this->object->country_id = $this->object->country_id ? $this->object->country_id : $mysoc->country_id;
            $this->object->country_code = $this->object->country_code ? $this->object->country_code : $mysoc->country_code;
            $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
            $countrynotdefined = $langs->trans("ErrorSetACountryFirst") . ' (' . $langs->trans("SeeAbove") . ')';
            if ($user->admin) {
                $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
            }
            // State
            if ($this->object->country_id) {
                $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
            } else {
                $this->tpl['select_state'] = $countrynotdefined;
            }
            // Language
            if (!empty($conf->global->MAIN_MULTILANGS)) {
                $this->tpl['select_lang'] = $formadmin->select_language($this->object->default_lang ? $this->object->default_lang : $conf->global->MAIN_LANG_DEFAULT, 'default_lang', 0, 0, 1);
            }
            // VAT
            $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1);
            // Assujeti par defaut en creation
            // Select users
            $this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id, 'commercial_id', 1);
            // Local Tax
            // TODO mettre dans une classe propre au pays
            if ($mysoc->country_code == 'ES') {
                $this->tpl['localtax'] = '';
                if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td>';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td>';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td></tr>';
                } elseif ($mysoc->localtax1_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td colspan="3">';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td><tr>';
                } elseif ($mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td colspan="3">';
                    $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
                    $this->tpl['localtax'] .= '</td><tr>';
                }
            }
        } else {
            $head = societe_prepare_head($this->object);
            $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company');
            $this->tpl['showend'] = dol_get_fiche_end();
            $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', $user->societe_id ? 0 : 1, 'rowid', 'nom');
            $this->tpl['checkcustomercode'] = $this->object->check_codeclient();
            $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
            $this->tpl['address'] = dol_nl2br($this->object->address);
            $img = picto_from_langcode($this->object->country_code);
            if ($this->object->isInEEC()) {
                $this->tpl['country'] = $form->textwithpicto(($img ? $img . ' ' : '') . $this->object->country, $langs->trans("CountryIsInEEC"), 1, 0);
            }
            $this->tpl['country'] = ($img ? $img . ' ' : '') . $this->object->country;
            $this->tpl['phone'] = dol_print_phone($this->object->phone, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
            $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX');
            $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
            $this->tpl['url'] = dol_print_url($this->object->url);
            $this->tpl['tva_assuj'] = yn($this->object->tva_assuj);
            // Third party type
            $arr = $formcompany->typent_array(1);
            $this->tpl['typent'] = $arr[$this->object->typent_code];
            if (!empty($conf->global->MAIN_MULTILANGS)) {
                require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
                //$s=picto_from_langcode($this->default_lang);
                //print ($s?$s.' ':'');
                $langs->load("languages");
                $this->tpl['default_lang'] = $this->default_lang ? $langs->trans('Language_' . $this->object->default_lang) : '';
            }
            $this->tpl['image_edit'] = img_edit();
            $this->tpl['display_rib'] = $this->object->display_rib();
            // Sales representatives
            $this->tpl['sales_representatives'] = '';
            $listsalesrepresentatives = $this->object->getSalesRepresentatives($user);
            $nbofsalesrepresentative = count($listsalesrepresentatives);
            if ($nbofsalesrepresentative > 3) {
                $this->tpl['sales_representatives'] .= '<a href="' . DOL_URL_ROOT . '/societe/commerciaux.php?socid=' . $this->object->id . '">';
                $this->tpl['sales_representatives'] .= $nbofsalesrepresentative;
                $this->tpl['sales_representatives'] .= '</a>';
            } else {
                if ($nbofsalesrepresentative > 0) {
                    $userstatic = new User($this->db);
                    $i = 0;
                    foreach ($listsalesrepresentatives as $val) {
                        $userstatic->id = $val['id'];
                        $userstatic->lastname = $val['name'];
                        $userstatic->firstname = $val['firstname'];
                        $this->tpl['sales_representatives'] .= $userstatic->getNomUrl(1);
                        $i++;
                        if ($i < $nbofsalesrepresentative) {
                            $this->tpl['sales_representatives'] .= ', ';
                        }
                    }
                } else {
                    $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected");
                }
            }
            // Linked member
            if (!empty($conf->adherent->enabled)) {
                $langs->load("members");
                $adh = new Adherent($this->db);
                $result = $adh->fetch('', '', $this->object->id);
                if ($result > 0) {
                    $adh->ref = $adh->getFullName($langs);
                    $this->tpl['linked_member'] = $adh->getNomUrl(1);
                } else {
                    $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember");
                }
            }
            // Local Tax
            // TODO mettre dans une classe propre au pays
            if ($mysoc->country_code == 'ES') {
                $this->tpl['localtax'] = '';
                if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax1_assuj) . '</td>';
                    $this->tpl['localtax'] .= '<td>' . $langs->trans("LocalTax2IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax2_assuj) . '</td></tr>';
                } elseif ($mysoc->localtax1_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax1_assuj) . '</td></tr>';
                } elseif ($mysoc->localtax2_assuj == "1") {
                    $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td>';
                    $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax2_assuj) . '</td></tr>';
                }
            }
        }
    }
    /**
     *  Set content of ->tpl array, to use into template
     *
     *  @param	string		$action    Type of action
     *  @param	int			$id			Id
     *  @return	string					HTML output
     */
    function assign_values(&$action, $id)
    {
        global $conf, $langs, $user, $canvas;
        global $form, $formcompany, $objsoc;
        if ($action == 'add' || $action == 'update') {
            $this->assign_post();
        }
        foreach ($this->object as $key => $value) {
            $this->tpl[$key] = $value;
        }
        $this->tpl['error'] = $this->error;
        $this->tpl['errors'] = $this->errors;
        if ($action == 'create' || $action == 'edit') {
            if ($conf->use_javascript_ajax) {
                $this->tpl['ajax_selectcountry'] = "\n" . '<script type="text/javascript" language="javascript">
				jQuery(document).ready(function () {
						jQuery("#selectcountry_id").change(function() {
							document.formsoc.action.value="' . $action . '";
							document.formsoc.canvas.value="' . $canvas . '";
							document.formsoc.submit();
						});
					})
				</script>' . "\n";
            }
            if (is_object($objsoc) && $objsoc->id > 0) {
                $this->tpl['company'] = $objsoc->getNomUrl(1);
                $this->tpl['company_id'] = $objsoc->id;
            } else {
                $this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1);
            }
            // Civility
            $this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id);
            // Predefined with third party
            if (isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) {
                if (dol_strlen(trim($this->object->address)) == 0) {
                    $this->tpl['address'] = $objsoc->address;
                }
                if (dol_strlen(trim($this->object->zip)) == 0) {
                    $this->object->zip = $objsoc->zip;
                }
                if (dol_strlen(trim($this->object->town)) == 0) {
                    $this->object->town = $objsoc->town;
                }
                if (dol_strlen(trim($this->object->phone_pro)) == 0) {
                    $this->object->phone_pro = $objsoc->phone;
                }
                if (dol_strlen(trim($this->object->fax)) == 0) {
                    $this->object->fax = $objsoc->fax;
                }
                if (dol_strlen(trim($this->object->email)) == 0) {
                    $this->object->email = $objsoc->email;
                }
            }
            // Zip
            $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
            // Town
            $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
            if (dol_strlen(trim($this->object->country_id)) == 0) {
                $this->object->country_id = $objsoc->country_id;
            }
            // Country
            $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
            $countrynotdefined = $langs->trans("ErrorSetACountryFirst") . ' (' . $langs->trans("SeeAbove") . ')';
            if ($user->admin) {
                $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
            }
            // State
            if ($this->object->country_id) {
                $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement, $this->object->country_code);
            } else {
                $this->tpl['select_state'] = $countrynotdefined;
            }
            // Public or private
            $selectarray = array('0' => $langs->trans("ContactPublic"), '1' => $langs->trans("ContactPrivate"));
            $this->tpl['select_visibility'] = $form->selectarray('priv', $selectarray, $this->object->priv, 0);
        }
        if ($action == 'view' || $action == 'edit' || $action == 'delete') {
            // Emailing
            if (!empty($conf->mailing->enabled)) {
                $langs->load("mails");
                $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
            }
            // Linked element
            $this->tpl['contact_element'] = array();
            $i = 0;
            $this->object->load_ref_elements();
            if (!empty($conf->commande->enabled)) {
                $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForOrders");
                $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_commande ? $this->object->ref_commande : $langs->trans("NoContactForAnyOrder");
                $i++;
            }
            if (!empty($conf->propal->enabled)) {
                $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForProposals");
                $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_propal ? $this->object->ref_propal : $langs->trans("NoContactForAnyProposal");
                $i++;
            }
            if (!empty($conf->contrat->enabled)) {
                $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForContracts");
                $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_contrat ? $this->object->ref_contrat : $langs->trans("NoContactForAnyContract");
                $i++;
            }
            if (!empty($conf->facture->enabled)) {
                $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForInvoices");
                $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_facturation ? $this->object->ref_facturation : $langs->trans("NoContactForAnyInvoice");
                $i++;
            }
            // Dolibarr user
            if ($this->object->user_id) {
                $dolibarr_user = new User($this->db);
                $result = $dolibarr_user->fetch($this->object->user_id);
                $this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
            } else {
                $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
            }
        }
        if ($action == 'view' || $action == 'delete') {
            $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id');
            if ($this->object->socid > 0) {
                $objsoc = new Societe($this->db);
                $objsoc->fetch($this->object->socid);
                $this->tpl['company'] = $objsoc->getNomUrl(1);
            } else {
                $this->tpl['company'] = $langs->trans("ContactNotLinkedToCompany");
            }
            $this->tpl['civility'] = $this->object->getCivilityLabel();
            $this->tpl['address'] = dol_nl2br($this->object->address);
            $this->tpl['zip'] = $this->object->zip ? $this->object->zip . '&nbsp;' : '';
            $img = picto_from_langcode($this->object->country_code);
            $this->tpl['country'] = ($img ? $img . ' ' : '') . $this->object->country;
            $this->tpl['phone_pro'] = dol_print_phone($this->object->phone_pro, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
            $this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
            $this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
            $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX');
            $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
            $this->tpl['visibility'] = $this->object->LibPubPriv($this->object->priv);
            $this->tpl['note'] = nl2br($this->object->note);
        }
        if ($action == 'create_user') {
            // Full firstname and lastname separated with a dot : firstname.lastname
            include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
            require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
            $login = dol_buildlogin($this->object->lastname, $this->object->firstname);
            $generated_password = getRandomPassword(false);
            $password = $generated_password;
            // Create a form array
            $formquestion = array(array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password));
            $this->tpl['action_create_user'] = $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $this->object->id, $langs->trans("CreateDolibarrLogin"), $langs->trans("ConfirmCreateContact"), "confirm_create_user", $formquestion, 'no');
        }
    }
Example #25
0
        print $object->zip.($object->zip && $object->town?" / ":"").$object->town;
        print "</td>";
        print '</tr>';

        // Country
        print '<tr><td>'.$langs->trans("Country").'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'" nowrap="nowrap">';
        $img=picto_from_langcode($object->country_code);
        if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
        else print ($img?$img.' ':'').$object->country;
        print '</td></tr>';

        // State
        if (empty($conf->global->SOCIETE_DISABLE_STATE)) print '<tr><td>'.$langs->trans('State').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->state.'</td>';

        print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'</td>';
        print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';

        // EMail
        print '<tr><td>'.$langs->trans('EMail').'</td><td width="25%">';
        print dol_print_email($object->email,0,$object->id,'AC_EMAIL');
        print '</td>';

        // Web
        print '<td>'.$langs->trans('Web').'</td><td>';
        print dol_print_url($object->url);
        print '</td></tr>';

        // Prof ids
        $i=1; $j=0;
        while ($i <= 6)
        {
Example #26
0
			}
			print '</td></tr>' . "\n";

			// Tel pro
			print '<tr><td valign="top">' . $langs->trans("PhonePro") . '</td>';
			print '<td>' . dol_print_phone($fuser->values->PhonePro, '', 0, 0, 1) . '</td>';
			print '</tr>' . "\n";

			// Tel mobile
			print '<tr><td valign="top">' . $langs->trans("PhoneMobile") . '</td>';
			print '<td>' . dol_print_phone($fuser->values->PhoneMobile, '', 0, 0, 1) . '</td>';
			print '</tr>' . "\n";

			// Fax
			print '<tr><td valign="top">' . $langs->trans("Fax") . '</td>';
			print '<td>' . dol_print_phone($fuser->values->Fax, '', 0, 0, 1) . '</td>';
			print '</tr>' . "\n";

			// EMail
			print '<tr><td valign="top">' . $langs->trans("EMail") . '</td>';
			print '<td>' . dol_print_email($fuser->values->EMail, 0, 0, 1) . '</td>';
			print "</tr>\n";

			// Signature
			print '<tr><td valign="top">' . $langs->trans('Signature') . '</td>';
			print '<td>' . $fuser->values->Signature . '</td>';
			print "</tr>\n";

			// Statut
			print '<tr><td valign="top">' . $langs->trans("Status") . '</td>';
			print '<td>';
Example #27
0
 /**
  * Return HTML string to put an output field into a page
  *
  * @param   string	$key            Key of attribute
  * @param   string	$value          Value to show
  * @param	string	$moreparam		To add more parametes on html input tag (only checkbox use html input for output rendering)
  * @return	string					Formated value
  */
 function showOutputField($key, $value, $moreparam = '')
 {
     global $conf, $langs;
     $label = $this->attribute_label[$key];
     $type = $this->attribute_type[$key];
     $size = $this->attribute_size[$key];
     $elementtype = $this->attribute_elementtype[$key];
     $unique = $this->attribute_unique[$key];
     $required = $this->attribute_required[$key];
     $params = $this->attribute_param[$key];
     $perms = $this->attribute_perms[$key];
     $list = $this->attribute_list[$key];
     $showsize = 0;
     if ($type == 'date') {
         $showsize = 10;
         $value = dol_print_date($value, 'day');
     } elseif ($type == 'datetime') {
         $showsize = 19;
         $value = dol_print_date($value, 'dayhour');
     } elseif ($type == 'int') {
         $showsize = 10;
     } elseif ($type == 'double') {
         if (!empty($value)) {
             $value = price($value);
         }
     } elseif ($type == 'boolean') {
         $checked = '';
         if (!empty($value)) {
             $checked = ' checked ';
         }
         $value = '<input type="checkbox" ' . $checked . ' ' . ($moreparam ? $moreparam : '') . ' readonly disabled>';
     } elseif ($type == 'mail') {
         $value = dol_print_email($value);
     } elseif ($type == 'phone') {
         $value = dol_print_phone($value);
     } elseif ($type == 'price') {
         $value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
     } elseif ($type == 'select') {
         $value = $params['options'][$value];
     } elseif ($type == 'sellist') {
         $param_list = array_keys($params['options']);
         $InfoFieldList = explode(":", $param_list[0]);
         $selectkey = "rowid";
         $keyList = 'rowid';
         if (count($InfoFieldList) >= 3) {
             $selectkey = $InfoFieldList[2];
             $keyList = $InfoFieldList[2] . ' as rowid';
         }
         $fields_label = explode('|', $InfoFieldList[1]);
         if (is_array($fields_label)) {
             $keyList .= ', ';
             $keyList .= implode(', ', $fields_label);
         }
         $sql = 'SELECT ' . $keyList;
         $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
         if (strpos($InfoFieldList[4], 'extra') !== false) {
             $sql .= ' as main';
         }
         $sql .= " WHERE " . $selectkey . "='" . $this->db->escape($value) . "'";
         //$sql.= ' AND entity = '.$conf->entity;
         dol_syslog(get_class($this) . ':showOutputField:$type=sellist', LOG_DEBUG);
         $resql = $this->db->query($sql);
         if ($resql) {
             $value = '';
             // value was used, so now we reste it to use it to build final output
             $obj = $this->db->fetch_object($resql);
             // Several field into label (eq table:code|libelle:rowid)
             $fields_label = explode('|', $InfoFieldList[1]);
             if (is_array($fields_label) && count($fields_label) > 1) {
                 foreach ($fields_label as $field_toshow) {
                     $translabel = '';
                     if (!empty($obj->{$field_toshow})) {
                         $translabel = $langs->trans($obj->{$field_toshow});
                     }
                     if ($translabel != $field_toshow) {
                         $value .= dol_trunc($translabel, 18) . ' ';
                     } else {
                         $value .= $obj->{$field_toshow} . ' ';
                     }
                 }
             } else {
                 $translabel = '';
                 if (!empty($obj->{$InfoFieldList}[1])) {
                     $translabel = $langs->trans($obj->{$InfoFieldList}[1]);
                 }
                 if ($translabel != $obj->{$InfoFieldList}[1]) {
                     $value = dol_trunc($translabel, 18);
                 } else {
                     $value = $obj->{$InfoFieldList}[1];
                 }
             }
         } else {
             dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING);
         }
     } elseif ($type == 'radio') {
         $value = $params['options'][$value];
     } elseif ($type == 'checkbox') {
         $value_arr = explode(',', $value);
         $value = '';
         if (is_array($value_arr)) {
             foreach ($value_arr as $keyval => $valueval) {
                 $value .= $params['options'][$valueval] . '<br>';
             }
         }
     } elseif ($type == 'chkbxlst') {
         $value_arr = explode(',', $value);
         $param_list = array_keys($params['options']);
         $InfoFieldList = explode(":", $param_list[0]);
         $selectkey = "rowid";
         $keyList = 'rowid';
         if (count($InfoFieldList) >= 3) {
             $selectkey = $InfoFieldList[2];
             $keyList = $InfoFieldList[2] . ' as rowid';
         }
         $fields_label = explode('|', $InfoFieldList[1]);
         if (is_array($fields_label)) {
             $keyList .= ', ';
             $keyList .= implode(', ', $fields_label);
         }
         $sql = 'SELECT ' . $keyList;
         $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
         if (strpos($InfoFieldList[4], 'extra') !== false) {
             $sql .= ' as main';
         }
         // $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
         // $sql.= ' AND entity = '.$conf->entity;
         dol_syslog(get_class($this) . ':showOutputField:$type=chkbxlst', LOG_DEBUG);
         $resql = $this->db->query($sql);
         if ($resql) {
             $value = '';
             // value was used, so now we reste it to use it to build final output
             while ($obj = $this->db->fetch_object($resql)) {
                 // Several field into label (eq table:code|libelle:rowid)
                 $fields_label = explode('|', $InfoFieldList[1]);
                 if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
                     if (is_array($fields_label) && count($fields_label) > 1) {
                         foreach ($fields_label as $field_toshow) {
                             $translabel = '';
                             if (!empty($obj->{$field_toshow})) {
                                 $translabel = $langs->trans($obj->{$field_toshow});
                             }
                             if ($translabel != $field_toshow) {
                                 $value .= dol_trunc($translabel, 18) . '<BR>';
                             } else {
                                 $value .= $obj->{$field_toshow} . '<BR>';
                             }
                         }
                     } else {
                         $translabel = '';
                         if (!empty($obj->{$InfoFieldList}[1])) {
                             $translabel = $langs->trans($obj->{$InfoFieldList}[1]);
                         }
                         if ($translabel != $obj->{$InfoFieldList}[1]) {
                             $value .= dol_trunc($translabel, 18) . '<BR>';
                         } else {
                             $value .= $obj->{$InfoFieldList}[1] . '<BR>';
                         }
                     }
                 }
             }
         } else {
             dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING);
         }
     } elseif ($type == 'link') {
         $out = '';
         // only if something to display (perf)
         if ($value) {
             $param_list = array_keys($params['options']);
             // 0 : ObjectName
             // 1 : classPath
             $InfoFieldList = explode(":", $param_list[0]);
             dol_include_once($InfoFieldList[1]);
             if ($InfoFieldList[0] && class_exists($InfoFieldList[0])) {
                 $object = new $InfoFieldList[0]($this->db);
                 $object->fetch($value);
                 $value = $object->getNomUrl(3);
             } else {
                 dol_syslog('Error bad setup of extrafield', LOG_WARNING);
                 $out .= 'Error bad setup of extrafield';
             }
         }
     } elseif ($type == 'text') {
         $value = dol_htmlentitiesbr($value);
     } else {
         $showsize = round($size);
         if ($showsize > 48) {
             $showsize = 48;
         }
     }
     //print $type.'-'.$size;
     $out = $value;
     return $out;
 }
Example #28
0
/**
 * 		Show html area for list of contacts
 *		@param		conf		Object conf
 * 		@param		langs		Object langs
 * 		@param		db			Database handler
 * 		@param		object		Third party object
 *      @param      backtopage  Url to go once contact is created
 */
function show_contacts($conf,$langs,$db,$object,$backtopage='')
{
    global $user;
    global $bc;

    $i=-1;

    $contactstatic = new Contact($db);

    if ($conf->clicktodial->enabled)
    {
        $user->fetch_clicktodial(); // lecture des infos de clicktodial
    }

    $buttoncreate='';
    if ($user->rights->societe->contact->creer)
    {
        //$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddContact").'</a>'."\n";
		$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddContact").' '.img_picto($langs->trans("AddContact"),'filenew').'</a>'."\n";
    }

    print "\n";
    print_fiche_titre($langs->trans("ContactsForCompany"),$buttoncreate,'');

    print "\n".'<table class="noborder" width="100%">'."\n";

    print '<tr class="liste_titre"><td>'.$langs->trans("Name").'</td>';
    print '<td>'.$langs->trans("Poste").'</td><td>'.$langs->trans("Tel").'</td>';
    print '<td>'.$langs->trans("Fax").'</td><td>'.$langs->trans("EMail").'</td>';
    print "<td>&nbsp;</td>";
    if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
    {
        print '<td>&nbsp;</td>';
    }
    print "</tr>";

    $sql = "SELECT p.rowid, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note ";
    $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
    $sql .= " WHERE p.fk_soc = ".$object->id;
    $sql .= " ORDER by p.datec";

    $result = $db->query($sql);
    $num = $db->num_rows($result);

    if ($num)
    {
        $i=0;
        $var=true;

        while ($i < $num)
        {
            $obj = $db->fetch_object($result);
            $var = !$var;

            print "<tr ".$bc[$var].">";

            print '<td>';
            $contactstatic->id = $obj->rowid;
            $contactstatic->name = $obj->name;
            $contactstatic->firstname = $obj->firstname;
            print $contactstatic->getNomUrl(1);
            print '</td>';

            print '<td>'.$obj->poste.'</td>';

            // Lien click to dial
            print '<td>';
            print dol_print_phone($obj->phone,$obj->pays_code,$obj->rowid,$object->id,'AC_TEL');
            print '</td>';
            print '<td>';
            print dol_print_phone($obj->fax,$obj->pays_code,$obj->rowid,$object->id,'AC_FAX');
            print '</td>';
            print '<td>';
            print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL');
            print '</td>';

            if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
            {
                print '<td align="center"><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtourl).'">';
                print img_object($langs->trans("Rendez-Vous"),"action");
                print '</a></td>';
            }

            if ($user->rights->societe->contact->creer)
            {
                print '<td align="right">';
                print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?action=edit&amp;id='.$obj->rowid.'&amp;backtopage='.urlencode($backtopage).'">';
                print img_edit();
                print '</a></td>';
            }

            print "</tr>\n";
            $i++;
        }
    }
    else
    {
        //print "<tr ".$bc[$var].">";
        //print '<td>'.$langs->trans("NoContactsYetDefined").'</td>';
        //print "</tr>\n";
    }
    print "\n</table>\n";

    print "<br>\n";

    return $i;
}