Exemple #1
0
     print '<td align="center">';
     print $companystatic->getLibProspLevel();
     print "</td>";
 }
 if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
     // Prospect status
     print '<td align="center" class="nowrap"><div class="nowrap">';
     print '<div class="inline-block">' . $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']);
     print '</div> - <div class="inline-block">';
     foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
         $titlealt = 'default';
         if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
             $titlealt = $val['label'];
         }
         if ($obj->stcomm_id != $val['id']) {
             print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?stcommsocid=' . $obj->rowid . '&stcomm=' . $val['code'] . '&action=setstcomm' . $param . ($page ? '&page=' . urlencode($page) : '') . '">' . img_action($titlealt, $val['code']) . '</a>';
         }
     }
     print '</div></div></td>';
 }
 // Extra fields
 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
     foreach ($extrafields->attribute_label as $key => $val) {
         if (!empty($arrayfields["ef." . $key]['checked'])) {
             print '<td';
             $align = $extrafields->getAlignFlag($key);
             if ($align) {
                 print ' align="' . $align . '"';
             }
             print '>';
             $tmpkey = 'options_' . $key;
Exemple #2
0
		print "<td align=\"center\">";
		print $prospectstatic->LibLevel($obj->fk_prospectlevel);
		print "</td>";
		// Statut
		print '<td align="center" nowrap="nowrap">';
		print $prospectstatic->LibProspStatut($obj->fk_stcomm,2);
		print "</td>";

		//$sts = array(-1,0,1,2,3);
		print '<td align="right" nowrap="nowrap">';
		foreach ($sts as $key => $value)
		{
			if ($value <> $obj->fk_stcomm)
			{
				print '<a href="prospects.php?socid='.$obj->rowid.'&amp;pstcomm='.$value.'&amp;action=cstc&amp;'.$param.($page?'&amp;page='.$page:'').'">';
				print img_action(0,$value);
				print '</a>&nbsp;';
			}
		}
		print '</td>';

        print '<td align="right">';
		print $prospectstatic->getLibStatut(3);
        print '</td>';

        print "</tr>\n";
		$i++;
	}

	if ($num > $conf->liste_limit || $page > 0) print_barre_liste('', $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
Exemple #3
0
$sql .= " ORDER BY st.id";
$resql = $db->query($sql);
if ($resql) {
    $num = $db->num_rows($resql);
    $i = 0;
    if ($num > 0) {
        $var = true;
        print '<table class="noborder" width="100%">';
        print '<tr class="liste_titre">';
        print '<td colspan="2">' . $langs->trans("ProspectsByStatus") . '</td></tr>';
        while ($i < $num) {
            $obj = $db->fetch_object($resql);
            $var = !$var;
            print '<tr ' . $bc[$var] . '><td>';
            print '<a href="prospects.php?page=0&amp;stcomm=' . $obj->id . '">';
            print img_action($langs->trans("Show"), $obj->id) . ' ';
            print $langs->trans("StatusProspect" . $obj->id);
            print '</a></td><td align="right">' . $obj->cc . '</td></tr>';
            $i++;
        }
        print "</table><br>";
    }
}
/*
 * Liste des propal brouillons
 */
if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
    $sql = "SELECT p.rowid, p.ref, p.price, s.nom as sname";
    $sql .= " FROM " . MAIN_DB_PREFIX . "propal as p";
    $sql .= ", " . MAIN_DB_PREFIX . "societe as s";
    if (!$user->rights->societe->client->voir && !$socid) {
	/**
	 *  Return label of a given status
	 *
	 *  @param	int|string	$statut        	Id or code for prospection status
	 *  @param  int			$mode          	0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
	 *  @param	string		$label			Label to use for status for added status
	 *  @return string       	 			Libelle du statut
	 */
	function LibProspCommStatut($statut, $mode=0, $label='')
	{
		global $langs;
		$langs->load('customers');

		if ($mode == 2)
		{
			if ($statut == '-1' || $statut == 'ST_NO')         return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
			elseif ($statut ==  '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
			elseif ($statut ==  '1' || $statut == 'ST_TODO')  return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
			elseif ($statut ==  '2' || $statut == 'ST_PEND')  return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
			elseif ($statut ==  '3' || $statut == 'ST_DONE')  return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
			else
			{
				return img_action(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label, 0).' '.(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label);
			}
		}
		if ($mode == 3)
		{
			if ($statut == '-1' || $statut == 'ST_NO')         return img_action($langs->trans("StatusProspect-1"),-1);
			elseif ($statut ==  '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0);
			elseif ($statut ==  '1' || $statut == 'ST_TODO')  return img_action($langs->trans("StatusProspect1"), 1);
			elseif ($statut ==  '2' || $statut == 'ST_PEND')  return img_action($langs->trans("StatusProspect2"), 2);
			elseif ($statut ==  '3' || $statut == 'ST_DONE')  return img_action($langs->trans("StatusProspect3"), 3);
			else
			{
				return img_action(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label, 0);
			}
		}
		if ($mode == 4)
		{
			if ($statut == '-1' || $statut == 'ST_NO')         return img_action($langs->trans("StatusProspect-1"),-1).' '.$langs->trans("StatusProspect-1");
			elseif ($statut ==  '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
			elseif ($statut ==  '1' || $statut == 'ST_TODO')  return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
			elseif ($statut ==  '2' || $statut == 'ST_PEND')  return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
			elseif ($statut ==  '3' || $statut == 'ST_DONE')  return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
			else
			{
				return img_action(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label, 0).' '.(($langs->trans("StatusProspect".$statut) != "StatusProspect".$statut) ? $langs->trans("StatusProspect".$statut) : $label);
			}
		}

		return "Error, mode/status not found";
	}
Exemple #5
0
 function ProspectStatus()
 {
     global $user, $conf, $langs, $bc;
     $sql = "SELECT count(s.rowid) as cc,st.libelle,st.type,st.id";
     $sql .= " FROM " . MAIN_DB_PREFIX . "c_stcomm as st";
     //if (!$user->rights->societe->client->voir)
     //{
     //        $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = sc.fk_user";
     //}
     $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s on (s.fk_stcomm = st.id AND s.client IN (1,2,3) AND s.entity = " . $conf->entity . ")";
     if (!$user->rights->societe->client->voir) {
         $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc on (s.rowid = sc.fk_soc)";
     }
     //$sql.=")";
     $sql .= " WHERE st.active=1";
     if (!$user->rights->societe->client->voir) {
         $sql .= " AND sc.fk_user = "******" GROUP BY st.id";
     $sql .= " ORDER BY st.id DESC";
     //print $sql;exit;
     $array = array();
     $color = array(-1 => "#A51B00", 0 => "#CCC", 1 => "#000", 2 => "#FEF4AE", 3 => "#666", 4 => "#1f17c1", 5 => "#DE7603", 6 => "#D40000", 7 => "#7ac52e", 8 => "#1b651b", 9 => "#66c18c", 10 => "#2e99a0");
     $total = 0;
     $resql = $this->db->query($sql);
     if ($resql) {
         $num = $this->db->num_rows($resql);
         $i = 0;
         while ($i < $num) {
             $obj = $this->db->fetch_object($resql);
             $element = array();
             $element['id'] = $obj->id;
             $element['count'] = $obj->cc;
             $element['libelle'] = $obj->libelle;
             $element['type'] = $obj->type;
             $total += $obj->cc;
             $array[$i] = $element;
             $i++;
         }
     }
     $var = false;
     print '<table class="noborder" width="100%">';
     print '<tr class="liste_titre">';
     print '<td colspan="2">' . $langs->trans("ProspectsByStatus") . '</td></tr>';
     for ($i = 0, $size = sizeof($array); $i < $size; $i++) {
         print '<tr ' . $bc[$var] . '><td><a href=' . DOL_URL_ROOT . '/comm/list.php?pstcomm=' . $array[$i]['id'] . '>';
         print img_action($langs->trans("Show"), $array[$i]['id']) . ' ';
         print $langs->trans($array[$i]['libelle']);
         print '</a></td><td align="right">' . $array[$i]['count'] . '</td></tr>';
         $var = !$var;
     }
     print '</td></tr>';
     print "</table><br>";
 }
Exemple #6
0
     } else {
         print $object->getLibProspLevel();
     }
     print "</td>";
     print '</tr>';
     // Status
     $object->loadCacheOfProspStatus();
     print '<tr><td>' . $langs->trans("StatusProsp") . '</td><td colspan="3">' . $object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
     print ' &nbsp; &nbsp; <div class="floatright">';
     foreach ($object->cacheprospectstatus as $key => $val) {
         $titlealt = 'default';
         if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
             $titlealt = $val['label'];
         }
         if ($object->stcomm_id != $val['id']) {
             print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&stcomm=' . $val['code'] . '&action=setstcomm">' . img_action($titlealt, $val['code']) . '</a>';
         }
     }
     print '</div></td></tr>';
 }
 // Categories
 if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
     print '<tr><td>' . $langs->trans("Categories") . '</td>';
     print '<td colspan="3">';
     print $form->showCategories($object->id, 'customer', 1);
     print "</td></tr>";
 }
 // Other attributes
 $parameters = array('socid' => $object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
 // Note that $action and $object may have been modified by hook
Exemple #7
0
 /**
  *  Return label of a given status
  *
  *  @param	int		$statut        	Id statut
  *  @param  int		$mode          	0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
  *  @return string        			Libelle du statut
  */
 function LibProspStatut($statut, $mode = 0)
 {
     global $langs;
     $langs->load('customers');
     if ($mode == 2) {
         if ($statut == -1) {
             return img_action($langs->trans("StatusProspect-1"), -1) . ' ' . $langs->trans("StatusProspect-1");
         }
         if ($statut == 0) {
             return img_action($langs->trans("StatusProspect0"), 0) . ' ' . $langs->trans("StatusProspect0");
         }
         if ($statut == 1) {
             return img_action($langs->trans("StatusProspect1"), 1) . ' ' . $langs->trans("StatusProspect1");
         }
         if ($statut == 2) {
             return img_action($langs->trans("StatusProspect2"), 2) . ' ' . $langs->trans("StatusProspect2");
         }
         if ($statut == 3) {
             return img_action($langs->trans("StatusProspect3"), 3) . ' ' . $langs->trans("StatusProspect3");
         }
     }
     if ($mode == 3) {
         if ($statut == -1) {
             return img_action($langs->trans("StatusProspect-1"), -1);
         }
         if ($statut == 0) {
             return img_action($langs->trans("StatusProspect0"), 0);
         }
         if ($statut == 1) {
             return img_action($langs->trans("StatusProspect1"), 1);
         }
         if ($statut == 2) {
             return img_action($langs->trans("StatusProspect2"), 2);
         }
         if ($statut == 3) {
             return img_action($langs->trans("StatusProspect3"), 3);
         }
     }
     if ($mode == 4) {
         if ($statut == -1) {
             return img_action($langs->trans("StatusProspect-1"), -1) . ' ' . $langs->trans("StatusProspect-1");
         }
         if ($statut == 0) {
             return img_action($langs->trans("StatusProspect0"), 0) . ' ' . $langs->trans("StatusProspect0");
         }
         if ($statut == 1) {
             return img_action($langs->trans("StatusProspect1"), 1) . ' ' . $langs->trans("StatusProspect1");
         }
         if ($statut == 2) {
             return img_action($langs->trans("StatusProspect2"), 2) . ' ' . $langs->trans("StatusProspect2");
         }
         if ($statut == 3) {
             return img_action($langs->trans("StatusProspect3"), 3) . ' ' . $langs->trans("StatusProspect3");
         }
     }
     return "Error, mode/status not found";
 }
Exemple #8
0
 print '<tr><td>' . $langs->trans("StatusProsp") . '</td><td colspan="2">' . $object->getLibProspStatut(4) . '</td>';
 print '<td>';
 if ($object->stcomm_id != -1) {
     print '<a href="fiche.php?socid=' . $object->id . '&amp;stcomm=-1&amp;action=cstc">' . img_action(0, -1) . '</a>';
 }
 if ($object->stcomm_id != 0) {
     print '<a href="fiche.php?socid=' . $object->id . '&amp;stcomm=0&amp;action=cstc">' . img_action(0, 0) . '</a>';
 }
 if ($object->stcomm_id != 1) {
     print '<a href="fiche.php?socid=' . $object->id . '&amp;stcomm=1&amp;action=cstc">' . img_action(0, 1) . '</a>';
 }
 if ($object->stcomm_id != 2) {
     print '<a href="fiche.php?socid=' . $object->id . '&amp;stcomm=2&amp;action=cstc">' . img_action(0, 2) . '</a>';
 }
 if ($object->stcomm_id != 3) {
     print '<a href="fiche.php?socid=' . $object->id . '&amp;stcomm=3&amp;action=cstc">' . img_action(0, 3) . '</a>';
 }
 print '</td></tr>';
 // Sales representative
 include DOL_DOCUMENT_ROOT . '/societe/tpl/linesalesrepresentative.tpl.php';
 // Module Adherent
 if ($conf->adherent->enabled) {
     $langs->load("members");
     $langs->load("users");
     print '<tr><td width="25%" valign="top">' . $langs->trans("LinkedToDolibarrMember") . '</td>';
     print '<td colspan="3">';
     $adh = new Adherent($db);
     $result = $adh->fetch('', '', $object->id);
     if ($result > 0) {
         $adh->ref = $adh->getFullName($langs);
         print $adh->getNomUrl(1);