Fix: Click to dial picto is shown only if module configured

This commit is contained in:
Laurent Destailleur 2008-04-17 12:04:40 +00:00
parent aad9b2332e
commit 30747f3256
7 changed files with 36 additions and 30 deletions

View File

@ -65,8 +65,14 @@ if ($_POST["action"] == 'add_action')
if ($_POST['cancel']) if ($_POST['cancel'])
{ {
if ($_POST['socid'] > 0) header("Location: ".DOL_URL_ROOT.'/comm/fiche.php?socid='.$_POST['socid']); $back='';
else header("Location: ".DOL_URL_ROOT.'/comm/action/indexactions.php'); if (! empty($_POST["back"])) $back=$_POST["back"];
if (! $back)
{
if ($_POST['socid'] > 0) $back=DOL_URL_ROOT.'/comm/fiche.php?socid='.$_POST['socid'];
else $back=DOL_URL_ROOT.'/comm/action/indexactions.php';
}
header("Location: ".$back);
exit; exit;
} }
@ -401,12 +407,13 @@ if ($_GET["action"] == 'create')
if ($_GET["contactid"]) if ($_GET["contactid"])
{ {
$contact = new Contact($db); $contact = new Contact($db);
$contact->fetch($_GET["contactid"]); $result=$contact->fetch($_GET["contactid"]);
} }
print '<form name="action" action="fiche.php" method="post">'; print '<form name="action" action="fiche.php" method="post">';
if (! empty($_REQUEST["backtopage"])) print '<input type="hidden" name="from" value="'.($_REQUEST["from"] ? $_REQUEST["from"] : $_SERVER["HTTP_REFERER"]).'">'; if (! empty($_REQUEST["backtopage"])) print '<input type="hidden" name="from" value="'.($_REQUEST["from"] ? $_REQUEST["from"] : $_SERVER["HTTP_REFERER"]).'">';
print '<input type="hidden" name="action" value="add_action">'; print '<input type="hidden" name="action" value="add_action">';
print '<input type="hidden" name="back" value="'.$_SERVER['HTTP_REFERER'].'">';
if ($_GET["actioncode"] == 'AC_RDV') print_titre ($langs->trans("AddActionRendezVous")); if ($_GET["actioncode"] == 'AC_RDV') print_titre ($langs->trans("AddActionRendezVous"));
else print_titre ($langs->trans("AddAnAction")); else print_titre ($langs->trans("AddAnAction"));
@ -421,8 +428,8 @@ if ($_GET["action"] == 'create')
if ($_GET["actioncode"]) if ($_GET["actioncode"])
{ {
print '<input type="hidden" name="actioncode" value="'.$_GET["actioncode"].'">'."\n"; print '<input type="hidden" name="actioncode" value="'.$_GET["actioncode"].'">'."\n";
$caction->fetch($_GET["actioncode"]); $cactioncomm->fetch($_GET["actioncode"]);
print $caction->getNomUrl(); print $cactioncomm->getNomUrl();
} }
else else
{ {

View File

@ -680,7 +680,7 @@ if ($socid > 0)
print dolibarr_print_phone($obj->phone); print dolibarr_print_phone($obj->phone);
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
print '</a>'; print '</a>';
if ($obj->phone) print ' '.dol_phone_link($obj->phone); if ($obj->phone) print dol_phone_link($obj->phone);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)

View File

@ -301,7 +301,7 @@ if ($socid > 0)
print dolibarr_print_phone($obj->phone,''); print dolibarr_print_phone($obj->phone,'');
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
print '</a>'; print '</a>';
if ($obj->phone) print ' '.dol_phone_link($obj->phone); if ($obj->phone) print dol_phone_link($obj->phone);
print '</td>'; print '</td>';
// Fax // Fax

View File

@ -405,7 +405,7 @@ if ($socid > 0)
print $obj->phone; print $obj->phone;
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
print '</a>'; print '</a>';
if ($obj->phone) print ' '.dol_phone_link($obj->phone); if ($obj->phone) print dol_phone_link($obj->phone);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)

View File

@ -104,7 +104,7 @@ llxHeader();
$form=new Form($db); $form=new Form($db);
$sql = "SELECT s.rowid as socid, s.nom, "; $sql = "SELECT s.rowid as socid, s.nom, s.fk_pays,";
$sql.= " p.rowid as cidp, p.name, p.firstname, p.email, p.phone, p.phone_mobile, p.fax, p.priv,"; $sql.= " p.rowid as cidp, p.name, p.firstname, p.email, p.phone, p.phone_mobile, p.fax, p.priv,";
$sql.= " ".$db->pdate("p.tms")." as tms"; $sql.= " ".$db->pdate("p.tms")." as tms";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p";
@ -249,13 +249,7 @@ if ($result)
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_societe" size="10" value="'.$search_societe.'">'; print '<input class="flat" type="text" name="search_societe" size="10" value="'.$search_societe.'">';
print '</td>'; print '</td>';
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) print '<td class="liste_titre">&nbsp;</td>';
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
if ($_GET["view"] == 'phone') if ($_GET["view"] == 'phone')
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -271,7 +265,6 @@ if ($result)
print '<input class="flat" type="text" name="search_email" size="12" value="'.$search_email.'">'; print '<input class="flat" type="text" name="search_email" size="12" value="'.$search_email.'">';
print '</td>'; print '</td>';
} }
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
@ -316,16 +309,19 @@ if ($result)
} }
print '</td>'; print '</td>';
// Phone
print '<td>';
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
{ print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&amp;actioncode=AC_TEL&amp;contactid='.$obj->cidp.'&amp;socid='.$obj->socid.'">'.dolibarr_print_phone($obj->phone,$obj->fk_pays).'</a>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&amp;actioncode=AC_TEL&amp;contactid='.$obj->cidp.'&amp;socid='.$obj->socid.'">'.dolibarr_print_phone($obj->phone).'</a>&nbsp;</td>'; else
} print dolibarr_print_phone($obj->phone,$obj->fk_pays);
print '</td>';
if ($_GET["view"] == 'phone') if ($_GET["view"] == 'phone')
{ {
print '<td>'.dolibarr_print_phone($obj->phone_mobile,$obj->fp_pays).'&nbsp;</td>'; print '<td>'.dolibarr_print_phone($obj->phone_mobile,$obj->fk_pays).'&nbsp;</td>';
print '<td>'.dolibarr_print_phone($obj->fax,$obj->fp_pays).'&nbsp;</td>'; print '<td>'.dolibarr_print_phone($obj->fax,$obj->fk_pays).'&nbsp;</td>';
} }
else else
{ {

View File

@ -326,7 +326,7 @@ if ( $societe->fetch($socid) )
print "</td>"; print "</td>";
print "<td>$obj->poste&nbsp;</td>"; print "<td>$obj->poste&nbsp;</td>";
print '<td><a href="../comm/action/fiche.php?action=create&actioncode=AC_TEL&contactid='.$obj->rowid.'&socid='.$societe->id.'">'.$obj->phone.'</a>'; print '<td><a href="../comm/action/fiche.php?action=create&actioncode=AC_TEL&contactid='.$obj->rowid.'&socid='.$societe->id.'">'.$obj->phone.'</a>';
if ($obj->phone) print ' '.dol_phone_link($obj->phone); if ($obj->phone) print dol_phone_link($obj->phone);
print '</td>'; print '</td>';
print '<td><a href="../comm/action/fiche.php?action=create&actioncode=AC_FAX&contactid='.$obj->rowid.'&socid='.$societe->id.'">'.$obj->fax.'</a></td>'; print '<td><a href="../comm/action/fiche.php?action=create&actioncode=AC_FAX&contactid='.$obj->rowid.'&socid='.$societe->id.'">'.$obj->fax.'</a></td>';
print '<td><a href="../comm/action/fiche.php?action=create&actioncode=AC_EMAIL&contactid='.$obj->rowid.'&socid='.$societe->id.'">'.$obj->email.'</a></td>'; print '<td><a href="../comm/action/fiche.php?action=create&actioncode=AC_EMAIL&contactid='.$obj->rowid.'&socid='.$societe->id.'">'.$obj->email.'</a></td>';

View File

@ -683,12 +683,15 @@ function dol_phone_link($phone,$option=0)
global $conf,$user; global $conf,$user;
$link=''; $link='';
$phone=trim($phone); //if (! empty($conf->global->CLICKTODIAL_URL))
if ($conf->clicktodial->enabled)
$url = $conf->global->CLICKTODIAL_URL; {
$url.= "?login=".urlencode($user->clicktodial_login)."&password=".urlencode($user->clicktodial_password); $phone=trim($phone);
$url.= "&caller=".urlencode($user->clicktodial_poste)."&called=".urlencode(trim($phone)); $url = $conf->global->CLICKTODIAL_URL;
$link.='<a href="#" onclick="newpopup(\''.$url.'\',\'\');">'.img_phone("default",0).'</a>'; $url.= "?login=".urlencode($user->clicktodial_login)."&password=".urlencode($user->clicktodial_password);
$url.= "&caller=".urlencode($user->clicktodial_poste)."&called=".urlencode(trim($phone));
$link.='<a href="URL_DEFINED_IN_CLICKTODIAL_MODULE" onclick="newpopup(\''.$url.'\',\'\'); return false;">'.img_phone("default",0).'</a>';
}
return $link; return $link;
} }