/**
  * Return select filter with date of transaction
  *
  * @param string $htmlname Name of select field
  * @param string $selectedkey Value
  * @return string HTML edit field
  */
 function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
 {
     $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
     $sql .= ' ORDER BY import_key DESC';
     $out = '<SELECT name="' . $htmlname . '">';
     dol_syslog(get_class($this) . "::select_bookkeeping_importkey sql=" . $sql, LOG_DEBUG);
     $resql = $this->db->query($sql);
     if ($resql) {
         $i = 0;
         $num = $this->db->num_rows($resql);
         while ($i < $num) {
             $obj = $this->db->fetch_object($resql);
             $selected = '';
             if ($selectedkey == $obj->import_key) {
                 $selected = ' selected ';
             }
             $out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . dol_print_date($obj->import_key, 'dayhourtext') . '</OPTION>';
             $i++;
         }
     } else {
         $this->error = "Error " . $this->db->lasterror();
         dol_syslog(get_class($this) . "::select_bookkeeping_importkey " . $this->error, LOG_ERR);
         return -1;
     }
     $out .= '</SELECT>';
     return $out;
 }
Ejemplo n.º 2
0
/**
*    Show header of a VAT report
*    @param      nom             Name of report
*    @param      variante        Link for alternate report
*    @param      period          Period of report
*    @param      periodlink      Link to switch period
*    @param      description     Description
*    @param      builddate       Date generation
*    @param      exportlink      Link for export or ''
*/
function report_header($nom,$variante='',$period,$periodlink,$description,$builddate,$exportlink='')
{
	global $langs;

	print "\n\n<!-- debut cartouche rapport -->\n";

	$h=0;
	$head[$h][0] = $_SERVER["PHP_SELF"];
	$head[$h][1] = $langs->trans("Report");
	dol_fiche_head($head, $hselected, $societe->nom);

	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
	print '<table width="100%" class="border">';

	// Ligne de titre
	print '<tr>';
	print '<td valign="top" width="110">'.$langs->trans("ReportName").'</td>';
	if (! $variante) print '<td colspan="3">';
	else print '<td>';
	print $nom;
	if ($variante) print '</td><td colspan="2">'.$variante;
	print '</td>';
	print '</tr>';

	// Ligne de la periode d'analyse du rapport
	print '<tr>';
	print '<td>'.$langs->trans("ReportPeriod").'</td>';
	if (! $periodlink) print '<td colspan="3">';
	else print '<td>';
	if ($period) print $period;
	if ($periodlink) print '</td><td colspan="2">'.$periodlink;
	print '</td>';
	print '</tr>';

	// Ligne de description
	print '<tr>';
	print '<td valign="top">'.$langs->trans("ReportDescription").'</td>';
	print '<td colspan="3">'.$description.'</td>';
	print '</tr>';

	// Ligne d'export
	print '<tr>';
	print '<td>'.$langs->trans("GeneratedOn").'</td>';
	if (! $exportlink) print '<td colspan="3">';
	else print '<td>';
	print dol_print_date($builddate);
	if ($exportlink) print '</td><td>'.$langs->trans("Export").'</td><td>'.$exportlink;
	print '</td></tr>';

	print '<tr>';
	print '<td colspan="4" align="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></td>';
	print '</tr>';

	print '</table>';

	print '</form>';

	print '</div>';
	print "\n<!-- fin cartouche rapport -->\n\n";
}
Ejemplo n.º 3
0
 /**
  *  Load data into info_box_contents array to show array later.
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 5)
 {
     global $conf, $user, $langs, $db;
     $langs->load("boxes");
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
     $thirdpartystatic = new Societe($db);
     include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
     $thirdpartytmp = new Fournisseur($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $max));
     if ($user->rights->societe->lire) {
         $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status,";
         $sql .= " s.code_fournisseur,";
         $sql .= " s.logo";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE s.fournisseur = 1";
         $sql .= " AND s.entity IN (" . getEntity('societe', 1) . ")";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
         }
         $sql .= " ORDER BY s.tms DESC ";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $line = 0;
             while ($line < $num) {
                 $objp = $db->fetch_object($result);
                 $datec = $db->jdate($objp->datec);
                 $datem = $db->jdate($objp->tms);
                 $thirdpartytmp->id = $objp->socid;
                 $thirdpartytmp->name = $objp->name;
                 $thirdpartytmp->code_client = $objp->code_client;
                 $thirdpartytmp->logo = $objp->logo;
                 $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $thirdpartytmp->getNomUrl(1, '', 40), 'asis' => 1);
                 $this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day"));
                 $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status, 3));
                 $line++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedSuppliers"));
             }
             $db->free($result);
         } else {
             $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
         }
     } else {
         $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }
 /**
  *  Load data into info_box_contents array to show array later.
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 5)
 {
     global $conf, $user, $langs, $db;
     $langs->load("boxes");
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
     $supplierorderstatic = new CommandeFournisseur($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLatestSupplierOrders", $max));
     if ($user->rights->fournisseur->commande->lire) {
         $sql = "SELECT s.nom, s.rowid as socid,";
         $sql .= " c.ref, c.tms, c.rowid,";
         $sql .= " c.fk_statut";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
         $sql .= ", " . MAIN_DB_PREFIX . "commande_fournisseur as c";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE c.fk_soc = s.rowid";
         $sql .= " AND c.entity = " . $conf->entity;
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
         }
         $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $datem = $db->jdate($objp->tms);
                 $urlo = DOL_URL_ROOT . "/fourn/commande/fiche.php?id=" . $objp->rowid;
                 $urls = DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid;
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => $urlo);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref, 'url' => $urlo);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => $urls);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => $urls);
                 $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datem, 'day'));
                 $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $supplierorderstatic->LibStatut($objp->fk_statut, 3));
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoSupplierOrder"));
             }
             $db->free($result);
         } else {
             $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
         }
     } else {
         $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }
Ejemplo n.º 5
0
 /**
  * Build Select List of element associable to a businesscase
  *
  * @param string $tablename To parse
  * @param Lead $lead The lead
  * @param string $htmlname Name of the component
  *
  * @return string HTML select list of element
  */
 function select_element($tablename, $lead, $htmlname = 'elementselect')
 {
     global $langs, $conf;
     switch ($tablename) {
         case "facture":
             $sql = "SELECT rowid, facnumber as ref, total as total_ht, date_valid as date_element";
             break;
         case "contrat":
             $sql = "SELECT rowid, ref as ref, 0 as total_ht, date_contrat as date_element";
             break;
         case "commande":
             $sql = "SELECT rowid, ref as ref, total_ht as total_ht, date_commande as date_element";
             break;
         default:
             $sql = "SELECT rowid, ref, total_ht, datep as date_element";
             break;
     }
     $sql .= " FROM " . MAIN_DB_PREFIX . $tablename;
     //TODO Fix sourcetype can be different from tablename (exemple project/projet)
     $sql .= " WHERE rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='" . $lead->element . "' AND sourcetype='" . $tablename . "')";
     // Manage filter
     /*if (count($filter) > 0) {
     			foreach ( $filter as $key => $value ) {
     				if (($key == 's.fk_session_place') || ($key == 'f.rowid') || ($key == 's.type_session') || ($key == 's.status') || ($key == 'sale.fk_user_com')) {
     					$sql .= ' AND ' . $key . ' = ' . $value;
     				} else {
     					$sql .= ' AND ' . $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
     				}
     			}
     		}*/
     $sql .= " AND fk_soc=" . $lead->fk_soc;
     $sql .= " AND entity=" . $conf->entity;
     // $sql.= " AND entity IN (".getEntity($object->element,1).")";
     $sql .= " ORDER BY ref DESC";
     dol_syslog(get_class($this) . "::select_element sql=" . $sql, LOG_DEBUG);
     $resql = $this->db->query($sql);
     if ($resql) {
         $num = $this->db->num_rows($resql);
         $i = 0;
         if ($num > 0) {
             $sellist = '<select class="flat" name="' . $htmlname . '">';
             while ($i < $num) {
                 $obj = $this->db->fetch_object($resql);
                 $sellist .= '<option value="' . $obj->rowid . '">' . $obj->ref . ' (' . dol_print_date($this->db->jdate($obj->date_element), 'daytextshort') . ')';
                 $sellist .= (empty($obj->total_ht) ? '' : '-' . price($obj->total_ht) . $langs->getCurrencySymbol($conf->currency)) . '</option>';
                 $i++;
             }
             $sellist .= '</select>';
         }
         return $sellist;
     }
     $this->db->free($resql);
     return null;
 }
 /**
  *  This is the main function that returns the array of emails.
  *
  *  @param	int		$mailing_id    	Id of mailing. No need to use it.
  *  @param  array	$filtersarray   If you used the formFilter function. Empty otherwise.
  *  @return int           			<0 if error, number of emails added if ok
  */
 function add_to_target($mailing_id, $filtersarray = array())
 {
     global $conf, $langs;
     $langs->load("members");
     $langs->load("companies");
     $cibles = array();
     // Select the members from category
     $sql = "SELECT a.rowid as id, a.email as email, a.lastname, null as fk_contact, a.firstname,";
     $sql .= " a.datefin, a.civilite as civility_id, a.login, a.societe,";
     // Other fields
     if ($_POST['filter']) {
         $sql .= " c.label";
     } else {
         $sql .= " null as label";
     }
     $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a";
     if ($_POST['filter']) {
         $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "categorie_member as cm ON cm.fk_member = a.rowid";
         $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "categorie as c ON c.rowid = cm.fk_categorie";
     }
     $sql .= " WHERE a.email != ''";
     $sql .= " AND a.entity = " . $conf->entity;
     if ($_POST['filter']) {
         $sql .= " AND c.rowid='" . $_POST['filter'] . "'";
     }
     $sql .= " ORDER BY a.email";
     // Stocke destinataires dans cibles
     $result = $this->db->query($sql);
     if ($result) {
         $num = $this->db->num_rows($result);
         $i = 0;
         $j = 0;
         dol_syslog(get_class($this) . "::add_to_target mailing " . $num . " targets found");
         $old = '';
         while ($i < $num) {
             $obj = $this->db->fetch_object($result);
             if ($old != $obj->email) {
                 $cibles[$j] = array('email' => $obj->email, 'fk_contact' => $obj->fk_contact, 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'other' => $langs->transnoentities("Login") . '=' . $obj->login . ';' . ($langs->transnoentities("UserTitle") . '=' . ($obj->civility_id ? $langs->transnoentities("Civility" . $obj->civility_id) : '')) . ';' . ($langs->transnoentities("DateEnd") . '=' . dol_print_date($this->db->jdate($obj->datefin), 'day')) . ';' . ($langs->transnoentities("Company") . '=' . $obj->societe) . ';' . ($obj->label ? $langs->transnoentities("Category") . '=' . $obj->label : ''), 'source_url' => $this->url($obj->id), 'source_id' => $obj->id, 'source_type' => 'member');
                 $old = $obj->email;
                 $j++;
             }
             $i++;
         }
     } else {
         dol_syslog($this->db->error());
         $this->error = $this->db->error();
         return -1;
     }
     return parent::add_to_target($mailing_id, $cibles);
 }
Ejemplo n.º 7
0
 /**
  *  Load data into info_box_contents array to show array later.
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 5)
 {
     global $user, $langs, $db, $conf;
     $langs->load("boxes");
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . "/adherents/class/adherent.class.php";
     $memberstatic = new Adherent($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max));
     if ($user->rights->societe->lire) {
         $sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
         $sql .= " t.cotisation";
         $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a, " . MAIN_DB_PREFIX . "adherent_type as t";
         $sql .= " WHERE a.entity = " . $conf->entity;
         $sql .= " AND a.fk_adherent_type = t.rowid";
         $sql .= " ORDER BY a.tms DESC";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $datec = $db->jdate($objp->datec);
                 $datem = $db->jdate($objp->tms);
                 $memberstatic->lastname = $objp->lastname;
                 $memberstatic->firstname = $objp->firstname;
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/adherents/fiche.php?rowid=" . $objp->rowid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $memberstatic->getFullName($langs), 'url' => DOL_URL_ROOT . "/adherents/fiche.php?rowid=" . $objp->rowid);
                 $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day"));
                 $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', 'text' => $memberstatic->LibStatut($objp->status, $objp->cotisation, $db->jdate($objp->date_end_subscription), 3));
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedCustomers"));
             }
         } else {
             $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
         }
     } else {
         $this->info_box_contents[0][0] = array('align' => 'left', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }
Ejemplo n.º 8
0
 /**
  * Make substitution
  *
  * @param	$object				Adherent Object
  * @return  string      		Value of input text string with substitutions done
  */
 function makeSubstitution($object)
 {
     global $conf, $langs;
     $text = $this->body;
     $birthday = dol_print_date($object->naiss, 'day');
     $msgishtml = 0;
     if (dol_textishtml($text, 1)) {
         $msgishtml = 1;
     }
     $infos = '';
     // Specific for Photo
     $photoName = $object->photo;
     $photoType = $object->_attachments->{$photoName}->content_type;
     $photoBase64 = $object->getFileBase64($object->photo);
     $photo = '<img src="data:' . $PhotoType . ';base64,' . $photoBase64 . '"/>';
     // Substitutions
     $substitutionarray = array('__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT, '__ID__' => $msgishtml ? dol_htmlentitiesbr($object->login) : $object->login, '__CIVILITE__' => $object->getCivilityLabel($msgishtml ? 0 : 1), '__FIRSTNAME__' => $msgishtml ? dol_htmlentitiesbr($object->Firstname) : $object->Firstname, '__LASTNAME__' => $msgishtml ? dol_htmlentitiesbr($object->Lastname) : $object->Lastname, '__FULLNAME__' => $msgishtml ? dol_htmlentitiesbr($object->getFullName($langs)) : $object->getFullName($langs), '__COMPANY__' => $msgishtml ? dol_htmlentitiesbr($object->societe) : $object->societe, '__ADDRESS__' => $msgishtml ? dol_htmlentitiesbr($object->address) : $object->address, '__ZIP__' => $msgishtml ? dol_htmlentitiesbr($object->zip) : $object->zip, '__TOWN__' => $msgishtml ? dol_htmlentitiesbr($object->town) : $object->town, '__COUNTRY__' => $msgishtml ? dol_htmlentitiesbr($object->country) : $object->country, '__EMAIL__' => $msgishtml ? dol_htmlentitiesbr($object->email) : $object->email, '__NAISS__' => $msgishtml ? dol_htmlentitiesbr($birthday) : $birthday, '__PHOTO__' => $photo, '__LOGIN__' => $msgishtml ? dol_htmlentitiesbr($object->login) : $object->login, '__PASSWORD__' => $msgishtml ? dol_htmlentitiesbr($object->pass) : $object->pass, '__STATUS__' => $object->getLibStatus(), '__INFOS__' => $msgishtml ? dol_htmlentitiesbr($infos) : $infos, '__PRENOM__' => $msgishtml ? dol_htmlentitiesbr($object->Firstname) : $object->Firstname, '__NOM__' => $msgishtml ? dol_htmlentitiesbr($object->Lastname) : $object->Lastname, '__SOCIETE__' => $msgishtml ? dol_htmlentitiesbr($object->societe) : $object->societe, '__ADRESSE__' => $msgishtml ? dol_htmlentitiesbr($object->address) : $object->address, '__CP__' => $msgishtml ? dol_htmlentitiesbr($object->zip) : $object->zip, '__VILLE__' => $msgishtml ? dol_htmlentitiesbr($object->town) : $object->town, '__PAYS__' => $msgishtml ? dol_htmlentitiesbr($object->country) : $object->country);
     complete_substitutions_array($substitutionarray, $langs);
     $this->body = make_substitutions($text, $substitutionarray);
     return 1;
 }
function _comments($id, $ref, $element)
{
    $element_tag = TTwiiit::getTag($element, $ref);
    $PDOdb = new TPDOdb();
    $r = '';
    $Tab = $PDOdb->ExecuteAsArray("SELECT DISTINCT t.rowid\n\tFROM " . MAIN_DB_PREFIX . "twiiit t  \n\t WHERE (t.fk_object=" . (int) $id . " AND t.type_object='" . $element . "') OR (t.comment LIKE '%" . $element_tag . "%')\n\t ORDER BY t.date_cre DESC");
    foreach ($Tab as &$row) {
        $twiiit = new TTwiiit();
        $twiiit->load($PDOdb, $row->rowid);
        $r .= '<div class="comm">';
        if ($id != $twiiit->fk_object || $element != $twiiit->type_object) {
            $origin_element = $twiiit->getNomUrl();
            if (!empty($origin_element)) {
                $r .= '<div class="object">' . $origin_element . '</div> ';
            }
        }
        $r .= $twiiit->getComment();
        $r .= '<div class="date">' . dol_print_date($twiiit->date_cre, 'dayhourtextshort') . '</div>';
        $r .= '</div>';
    }
    return $r;
}
Ejemplo n.º 10
0
 print empty($calcproducts['value']) ? '0' : $calcproducts['value'];
 print "</td></tr>";
 // Last movement
 $sql = "SELECT max(m.datem) as datem";
 $sql .= " FROM " . MAIN_DB_PREFIX . "stock_mouvement as m";
 $sql .= " WHERE m.fk_entrepot = '" . $object->id . "'";
 $resqlbis = $db->query($sql);
 if ($resqlbis) {
     $obj = $db->fetch_object($resqlbis);
     $lastmovementdate = $db->jdate($obj->datem);
 } else {
     dol_print_error($db);
 }
 print '<tr><td valign="top">' . $langs->trans("LastMovement") . '</td><td colspan="3">';
 if ($lastmovementdate) {
     print dol_print_date($lastmovementdate, 'dayhour') . ' ';
     print '(<a href="' . DOL_URL_ROOT . '/product/stock/mouvement.php?id=' . $object->id . '">' . $langs->trans("FullList") . '</a>)';
 } else {
     print $langs->trans("None");
 }
 print "</td></tr>";
 print "</table>";
 print '</div>';
 /* ************************************************************************** */
 /*                                                                            */
 /* Barre d'action                                                             */
 /*                                                                            */
 /* ************************************************************************** */
 print "<div class=\"tabsAction\">\n";
 $parameters = array();
 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
Ejemplo n.º 11
0
			}

			// Ref client
			print '<tr><td>'.$langs->trans("RefCustomer").'</td>';
			print '<td colspan="3">'.$delivery->ref_customer."</a></td>\n";
			print '</tr>';

			// Date
			print '<tr><td>'.$langs->trans("DateCreation").'</td>';
			print '<td colspan="3">'.dol_print_date($delivery->date_creation,'daytext')."</td>\n";
			print '</tr>';

			// Date delivery real / Received
			// TODO Can edit this date, even if delivery validated.
			print '<tr><td>'.$langs->trans("DateReceived").'</td>';
			print '<td colspan="3">'.dol_print_date($delivery->date_delivery,'daytext')."</td>\n";
			print '</tr>';

			// Statut
			print '<tr><td>'.$langs->trans("Status").'</td>';
			print '<td colspan="3">'.$delivery->getLibStatut(4)."</td>\n";
			print '</tr>';

			if (!$conf->expedition_bon->enabled && $conf->stock->enabled)
			{
				// Entrepot
				$entrepot = new Entrepot($db);
				$entrepot->fetch($delivery->entrepot_id);
				print '<tr><td width="20%">'.$langs->trans("Warehouse").'</td>';
				print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id.'">'.$entrepot->libelle.'</a></td>';
				print '</tr>';
Ejemplo n.º 12
0
	/**
	 *   	\brief      Show header of page
	 *    	\param      pdf     		Object PDF
	 *      \param      object          Object invoice
	 *      \param      showadress      0=no, 1=yes
	 *      \param      outputlangs		Object lang for output
	 */
	function _pagehead(&$pdf, $object, $showadress=1, $outputlangs)
	{
		global $langs,$conf,$mysoc;

		$outputlangs->load("main");
		$outputlangs->load("bills");
		$outputlangs->load("orders");
		$outputlangs->load("companies");

		$default_font_size = pdf_getPDFFontSize($outputlangs);

		// Do not add the BACKGROUND as this is for suppliers
		//pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);

		$pdf->SetTextColor(0,0,60);
		$pdf->SetFont('','B', $default_font_size + 3);

		$posy=$this->marge_haute;

		$pdf->SetXY($this->marge_gauche,$posy);

		// Logo
		/*
		$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
		if ($mysoc->logo)
		{
			if (is_readable($logo))
			{
				$pdf->Image($logo, $this->marge_gauche, $posy, 0, 24);
			}
			else
			{
				$pdf->SetTextColor(200,0,0);
				$pdf->SetFont('','B', $default_font_size - 2);
				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
			}
		}
		else
		{*/
			$text=$this->emetteur->name;
			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
		//}

		$pdf->SetFont('','B', $default_font_size + 3);
		$pdf->SetXY(100,$posy);
		$pdf->SetTextColor(0,0,60);
		$pdf->MultiCell(100, 4, $outputlangs->transnoentities("SupplierInvoice")." ".$outputlangs->convToOutputCharset($object->ref), '' , 'R');
		$pdf->SetFont('','', $default_font_size + 2);

		$posy+=6;
		$pdf->SetXY(100,$posy);
		if ($object->date)
		{
			$pdf->SetTextColor(0,0,60);
			$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date,"day",false,$outputlangs,true), '', 'R');
		}
		else
		{
			$pdf->SetTextColor(255,0,0);
			$pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R');
		}

		if ($showadress)
		{
			// Receive email
			$posy=42;
			$hautcadre=40;
			$pdf->SetTextColor(0,0,0);
			$pdf->SetFont('','', $default_font_size - 2);
			$pdf->SetXY($this->marge_gauche,$posy-5);
			$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillTo").":",0,"L");


			$pdf->SetXY($this->marge_gauche,$posy);
			$pdf->SetFillColor(230,230,230);
			$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);



			// Nom emetteur
			$carac_emetteur_name=$outputlangs->convToOutputCharset($mysoc->name);
			$pdf->SetTextColor(0,0,60);
			$pdf->SetFont('','B', $default_font_size);
			$pdf->SetXY($this->marge_gauche+2,$posy+3);
			$pdf->MultiCell(80, 4, $carac_emetteur_name, 0, 'L');

			// Sender properties
			$carac_emetteur = pdf_build_address($outputlangs,$mysoc);

			$pdf->SetFont('','', $default_font_size - 1);
			$pdf->SetXY($this->marge_gauche+2,$posy+8);
			$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');

			// Client destinataire
			$posy=42;
			$pdf->SetTextColor(0,0,0);
			$pdf->SetFont('','', $default_font_size - 2);
			$pdf->SetXY(100,$posy-5);
			$pdf->MultiCell(96, 4, $outputlangs->transnoentities("Supplier").":");
			//
			$client = new Societe($this->db);
			$client->fetch($object->socid);
			$object->client = $client;
			//

			// Cadre client destinataire
			$pdf->rect(100, $posy, 100, $hautcadre);

			// Recipient name
			if (! empty($usecontact))
			{
				// On peut utiliser le nom de la societe du contact
				if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname;
				else $socname = $object->client->nom;
				$carac_client_name=$outputlangs->convToOutputCharset($socname);
			}
			else
			{
				$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
			}

			$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');

			// Show customer/recipient
			$pdf->SetXY(102,$posy+3);
			$pdf->SetFont('','B', $default_font_size);
			$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');

			$pdf->SetFont('','', $default_font_size - 1);
			$pdf->SetXY(102,$posy+8);
			$pdf->MultiCell(96,4, $carac_client, 0, 'L');
		}
	}
Ejemplo n.º 13
0
         }
         print '</td>';
         print '<td width="16" align="center" class="nobordernopadding">';
         $filename = dol_sanitizeFileName($obj->ref);
         $filedir = $conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
         $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $obj->supplier_proposalid;
         print $formfile->getDocumentsLink($supplier_proposalstatic->element, $filename, $filedir);
         print '</td></tr></table>';
         print "</td>";
         $companystatic->id = $obj->socid;
         $companystatic->name = $obj->socname;
         $companystatic->client = $obj->client;
         $companystatic->canvas = $obj->canvas;
         print '<td align="left">' . $companystatic->getNomUrl(1, 'customer', 44) . '</td>' . "\n";
         print '<td align="right">';
         print dol_print_date($db->jdate($obj->dp), 'day') . '</td>' . "\n";
         print '<td align="right">' . price($obj->total_ttc) . '</td>';
         print '<td align="center" width="14">' . $supplier_proposalstatic->LibStatut($obj->fk_statut, 3) . '</td>' . "\n";
         print '</tr>' . "\n";
         $i++;
         $total += $obj->total_ttc;
     }
     if ($num > $nbofloop) {
         print '<tr class="liste_total"><td colspan="5">' . $langs->trans("XMoreLines", $num - $nbofloop) . "</td></tr>";
     } else {
         if ($total > 0) {
             print '<tr class="liste_total"><td colspan="3">' . $langs->trans("Total") . "</td><td align=\"right\">" . price($total) . "</td><td>&nbsp;</td></tr>";
         }
     }
     print "</table><br>";
 }
Ejemplo n.º 14
0
    print '<td align="right"><a href="' . DOL_URL_ROOT . '/product/stock/mouvement.php">' . $langs->trans("FullList") . '</a></td>';
    print "</tr>\n";
    $var = True;
    $i = 0;
    while ($i < min($num, $max)) {
        $objp = $db->fetch_object($resql);
        $var = !$var;
        print "<tr " . $bc[$var] . ">";
        print '<td>' . dol_print_date($db->jdate($objp->datem), 'dayhour') . '</td>';
        print "<td><a href=\"../card.php?id={$objp->rowid}\">";
        print img_object($langs->trans("ShowProduct"), "product") . ' ' . $objp->produit;
        print "</a></td>\n";
        if (!empty($conf->productbatch->enabled)) {
            print '<td>' . $objp->batch . '</td>';
            print '<td>' . dol_print_date($db->jdate($objp->eatby), 'day') . '</td>';
            print '<td>' . dol_print_date($db->jdate($objp->sellby), 'day') . '</td>';
        }
        print '<td><a href="card.php?id=' . $objp->entrepot_id . '">';
        print img_object($langs->trans("ShowWarehouse"), "stock") . ' ' . $objp->stock;
        print "</a></td>\n";
        print '<td align="right">';
        if ($objp->qty > 0) {
            print '+';
        }
        print $objp->qty . '</td>';
        print "</tr>\n";
        $i++;
    }
    $db->free($resql);
    print "</table>";
}
Ejemplo n.º 15
0
 /**
  *  Show top header of page.
  *
  *  @param	PDF			$pdf     		Object PDF
  *  @param  Object		$object     	Object to show
  *  @param  int	    	$showaddress    0=no, 1=yes
  *  @param  Translate	$outputlangs	Object lang for output
  *  @return	void
  */
 function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
 {
     global $conf, $langs;
     $outputlangs->load("main");
     $outputlangs->load("bills");
     $outputlangs->load("propal");
     $outputlangs->load("companies");
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
     // Show Draft Watermark
     if ($object->statut == 0 && !empty($conf->global->FACTURE_DRAFT_WATERMARK)) {
         pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
     }
     $pdf->SetTextColor(0, 0, 60);
     $pdf->SetFont('', 'B', $default_font_size + 3);
     $w = 110;
     $posy = $this->marge_haute;
     $posx = $this->page_largeur - $this->marge_droite - $w;
     $pdf->SetXY($this->marge_gauche, $posy);
     // Logo
     $logo = $conf->mycompany->dir_output . '/logos/' . $this->emetteur->logo;
     if ($this->emetteur->logo) {
         if (is_readable($logo)) {
             $height = pdf_getHeightForLogo($logo);
             $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
             // width=0 (auto)
         } else {
             $pdf->SetTextColor(200, 0, 0);
             $pdf->SetFont('', 'B', $default_font_size - 2);
             $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
             $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
         }
     } else {
         $text = $this->emetteur->name;
         $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
     }
     $pdf->SetFont('', 'B', $default_font_size + 3);
     $pdf->SetXY($posx, $posy);
     $pdf->SetTextColor(0, 0, 60);
     $title = $outputlangs->transnoentities("Invoice");
     if ($object->type == 1) {
         $title = $outputlangs->transnoentities("InvoiceReplacement");
     }
     if ($object->type == 2) {
         $title = $outputlangs->transnoentities("InvoiceAvoir");
     }
     if ($object->type == 3) {
         $title = $outputlangs->transnoentities("InvoiceDeposit");
     }
     if ($object->type == 4) {
         $title = $outputlangs->transnoentities("InvoiceProFormat");
     }
     $pdf->MultiCell($w, 3, $title, '', 'R');
     $pdf->SetFont('', 'B', $default_font_size);
     $posy += 5;
     $pdf->SetXY($posx, $posy);
     $pdf->SetTextColor(0, 0, 60);
     $pdf->MultiCell($w, 4, $outputlangs->transnoentities("Ref") . " : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
     $posy += 1;
     $pdf->SetFont('', '', $default_font_size - 2);
     if ($object->ref_client) {
         $posy += 4;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer") . " : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R');
     }
     $objectidnext = $object->getIdReplacingInvoice('validated');
     if ($object->type == 0 && $objectidnext) {
         $objectreplacing = new Facture($this->db);
         $objectreplacing->fetch($objectidnext);
         $posy += 3;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ReplacementByInvoice") . ' : ' . $outputlangs->convToOutputCharset($objectreplacing->ref), '', 'R');
     }
     if ($object->type == 1) {
         $objectreplaced = new Facture($this->db);
         $objectreplaced->fetch($object->fk_facture_source);
         $posy += 4;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ReplacementInvoice") . ' : ' . $outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R');
     }
     if ($object->type == 2 && !empty($object->fk_facture_source)) {
         $objectreplaced = new Facture($this->db);
         $objectreplaced->fetch($object->fk_facture_source);
         $posy += 3;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CorrectionInvoice") . ' : ' . $outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R');
     }
     $posy += 4;
     $pdf->SetXY($posx, $posy);
     $pdf->SetTextColor(0, 0, 60);
     $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateInvoice") . " : " . dol_print_date($object->date, "day", false, $outputlangs), '', 'R');
     if ($object->type != 2) {
         $posy += 3;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateEcheance") . " : " . dol_print_date($object->date_lim_reglement, "day", false, $outputlangs, true), '', 'R');
     }
     if ($object->thirdparty->code_client) {
         $posy += 3;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode") . " : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
     }
     $posy += 1;
     // Show list of linked objects
     $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size);
     if ($showaddress) {
         // Sender properties
         $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
         // Show sender
         $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
         $posx = $this->marge_gauche;
         if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
             $posx = $this->page_largeur - $this->marge_droite - 80;
         }
         $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
         $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
         // Show sender frame
         $pdf->SetTextColor(0, 0, 0);
         $pdf->SetFont('', '', $default_font_size - 2);
         $pdf->SetXY($posx, $posy - 5);
         $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom") . ":", 0, 'L');
         $pdf->SetXY($posx, $posy);
         $pdf->SetFillColor(230, 230, 230);
         $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
         $pdf->SetTextColor(0, 0, 60);
         // Show sender name
         $pdf->SetXY($posx + 2, $posy + 3);
         $pdf->SetFont('', 'B', $default_font_size);
         $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
         $posy = $pdf->getY();
         // Show sender information
         $pdf->SetXY($posx + 2, $posy);
         $pdf->SetFont('', '', $default_font_size - 1);
         $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, 'L');
         // If BILLING contact defined on invoice, we use it
         $usecontact = false;
         $arrayidcontact = $object->getIdContact('external', 'BILLING');
         if (count($arrayidcontact) > 0) {
             $usecontact = true;
             $result = $object->fetch_contact($arrayidcontact[0]);
         }
         //Recipient name
         // On peut utiliser le nom de la societe du contact
         if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
             $thirdparty = $object->contact;
         } else {
             $thirdparty = $object->client;
         }
         $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
         $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->client, $usecontact ? $object->contact : '', $usecontact, 'target');
         // Show recipient
         $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
         if ($this->page_largeur < 210) {
             $widthrecbox = 84;
         }
         // To work with US executive format
         $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
         $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
         if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
             $posx = $this->marge_gauche;
         }
         // Show recipient frame
         $pdf->SetTextColor(0, 0, 0);
         $pdf->SetFont('', '', $default_font_size - 2);
         $pdf->SetXY($posx + 2, $posy - 5);
         $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo") . ":", 0, 'L');
         $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
         // Show recipient name
         $pdf->SetXY($posx + 2, $posy + 3);
         $pdf->SetFont('', 'B', $default_font_size);
         $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L');
         $posy = $pdf->getY();
         // Show recipient information
         $pdf->SetFont('', '', $default_font_size - 1);
         $pdf->SetXY($posx + 2, $posy);
         $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
     }
     $pdf->SetTextColor(0, 0, 0);
 }
Ejemplo n.º 16
0
				$var=!$var;

				print "<tr $bc[$var]>";
				$classname = "impayee";

				print '<td nowrap>';
				$facturestatic->id=$objp->facid;
				$facturestatic->ref=$objp->ref;
				print $facturestatic->getNomUrl(1);
				print "</td>\n";

				print "<td nowrap>".dol_trunc($objp->facnumber,12)."</td>\n";

				print "<td nowrap align=\"center\">".dol_print_date($db->jdate($objp->df))."</td>\n";
				print "<td nowrap align=\"center\">".dol_print_date($db->jdate($objp->datelimite));
				if ($db->jdate($objp->datelimite) < ($now - $conf->facture->fournisseur->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late"));
				print "</td>\n";

				print '<td>';
				$companystatic->id=$objp->socid;
				$companystatic->nom=$objp->nom;
				print $companystatic->getNomUrl(1,'supplier',32);
				print '</td>';

				print "<td align=\"right\">".price($objp->total_ht)."</td>";
				print "<td align=\"right\">".price($objp->total_ttc)."</td>";
				print "<td align=\"right\">".price($objp->am)."</td>";

				// Affiche statut de la facture
				print '<td align="right" nowrap="nowrap">';
Ejemplo n.º 17
0
 $companystatic->client = $objp->client;
 $companystatic->code_client = $objp->code_client;
 print '<td>';
 print $companystatic->getNomUrl(1, 'customer');
 print '</td>';
 // Town
 print '<td class="nocellnopadd">';
 print $objp->town;
 print '</td>';
 // Date proposal
 print '<td align="center">';
 print dol_print_date($db->jdate($objp->dp), 'day');
 print "</td>\n";
 // Date end validity
 if ($objp->dfv) {
     print '<td align="center">' . dol_print_date($db->jdate($objp->dfv), 'day');
     print '</td>';
 } else {
     print '<td>&nbsp;</td>';
 }
 print '<td align="right">' . price($objp->total_ht) . "</td>\n";
 $userstatic->id = $objp->fk_user_author;
 $userstatic->login = $objp->login;
 print '<td align="center">';
 if ($userstatic->id) {
     print $userstatic->getLoginUrl(1);
 } else {
     print '&nbsp;';
 }
 print "</td>\n";
 print '<td align="right">' . $objectstatic->LibStatut($objp->fk_statut, 5) . "</td>\n";
Ejemplo n.º 18
0
	/**
	 *      \brief      Charge les donnees en memoire pour affichage ulterieur
	 *      \param      $max        Nombre maximum d'enregistrements a charger
	 */
	function loadBox($max=5)
	{
		global $user, $langs, $db, $conf;

		$this->max=$max;

        include_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
        $thirdpartystatic=new Societe($db);

		$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects",$max));

		if ($user->rights->societe->lire)
		{
			$sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.datec, s.tms, s.status";
			$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
			$sql.= " WHERE s.client IN (2, 3)";
			$sql.= " AND s.entity = ".$conf->entity;
			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = ".$user->societe_id;
			$sql.= " ORDER BY s.tms DESC";
			$sql.= $db->plimit($max, 0);

			dol_syslog("box_prospect::loadBox sql=".$sql,LOG_DEBUG);
			$resql = $db->query($sql);
			if ($resql)
			{
				$num = $db->num_rows($resql);

				$i = 0;
				$prospectstatic=new Prospect($db);
				while ($i < $num)
				{
					$objp = $db->fetch_object($resql);
					$datec=$db->jdate($objp->datec);
					$datem=$db->jdate($objp->tms);

					$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
			            'logo' => $this->boximg,
			            'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);

					$this->info_box_contents[$i][1] = array('td' => 'align="left"',
			            'text' => $objp->nom,
			            'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);

					$this->info_box_contents[$i][2] = array('td' => 'align="right"',
 			           'text' => dol_print_date($datem, "day"));

					$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
     			       'text' => str_replace('img ','img height="14" ',$prospectstatic->LibProspStatut($objp->fk_stcomm,3)));

                    $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
                    'text' => $thirdpartystatic->LibStatut($objp->status,3));

                    $i++;
				}

				if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProspects"));
			}
			else
			{
				$this->info_box_contents[0][0] = array(	'td' => 'align="left"',
    	        										'maxlength'=>500,
	            										'text' => ($db->error().' sql='.$sql));
			}
		}
		else {
			dol_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR);
			$this->info_box_contents[0][0] = array('td' => 'align="left"',
        'text' => $langs->trans("ReadPermissionNotAllowed"));
		}
	}
Ejemplo n.º 19
0
            $chargesociale_static->lib = $obj->id;
            $chargesociale_static->ref = $obj->id;
            print $chargesociale_static->getNomUrl(1, '20');
            print '</td>';
            // Label
            print '<td>' . dol_trunc($obj->libelle, 42) . '</td>';
            // Type
            print '<td>' . dol_trunc($obj->type_lib, 16) . '</td>';
            // Date end period
            print '<td align="center">';
            if ($obj->periode) {
                print '<a href="index.php?year=' . strftime("%Y", $db->jdate($obj->periode)) . '">' . dol_print_date($db->jdate($obj->periode), 'day') . '</a>';
            } else {
                print '&nbsp;';
            }
            print '</td>';
            print '<td align="right" width="100">' . price($obj->amount) . '</td>';
            // Due date
            print '<td width="110" align="center">' . dol_print_date($db->jdate($obj->date_ech), 'day') . '</td>';
            print '<td align="right" class="nowrap">' . $chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . '</a></td>';
            print '</tr>';
            $i++;
        }
        print '</table>';
        print '</form>';
    }
} else {
    dol_print_error($db);
}
$db->close();
llxFooter();
Ejemplo n.º 20
0
 print '</td>';
 print '<td align="left" class="liste_titre">';
 print '<input class="flat" type="text" size="10" name="search_desc" value="' . $search_desc . '">';
 print '</td>';
 print '<td align="right" class="liste_titre">';
 print '<input type="image" class="liste_titre" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
 print '</td>';
 print "</tr>\n";
 print '</form>';
 $var = True;
 while ($i < min($num, $conf->liste_limit)) {
     $obj = $db->fetch_object($result);
     $var = !$var;
     print '<tr ' . $bc[$var] . '>';
     // Date
     print '<td align="left" nowrap="nowrap">' . dol_print_date($db->jdate($obj->dateevent), '%Y-%m-%d %H:%M:%S') . '</td>';
     // Code
     print '<td>' . $obj->type . '</td>';
     // IP
     print '<td nowrap="nowrap">';
     print dol_print_ip($obj->ip);
     print '</td>';
     // Login
     print '<td nowrap="nowrap">';
     if ($obj->fk_user) {
         $userstatic->id = $obj->fk_user;
         $userstatic->login = $obj->login;
         print $userstatic->getLoginUrl(1);
     } else {
         print '&nbsp;';
     }
Ejemplo n.º 21
0
 }
 // Fields from hook
 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj);
 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters);
 // Note that $action and $object may have been modified by hook
 print $hookmanager->resPrint;
 // Date creation
 if (!empty($arrayfields['p.datec']['checked'])) {
     print '<td align="center">';
     print dol_print_date($objp->date_creation, 'dayhour');
     print '</td>';
 }
 // Date modification
 if (!empty($arrayfields['p.tms']['checked'])) {
     print '<td align="center">';
     print dol_print_date($objp->date_update, 'dayhour');
     print '</td>';
 }
 // Status (to sell)
 if (!empty($arrayfields['p.tosell']['checked'])) {
     print '<td align="center" nowrap="nowrap">';
     if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
         print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
     } else {
         print $product_static->LibStatut($objp->tosell, 5, 0);
     }
     print '</td>';
 }
 // Status (to buy)
 if (!empty($arrayfields['p.tobuy']['checked'])) {
     print '<td align="center" nowrap="nowrap">';
Ejemplo n.º 22
0
 print '</tr>';
 print '<tr class="liste_titre">';
 print '<td><input type="text" class="flat" name="search_soc" value="' . $search_soc . '" size="20"></td>';
 print '<td colspan="8">&nbsp;</td>';
 // Print the search button
 print '<td class="liste_titre" align="right">';
 print '<input class="liste_titre" name="button_search" type="image" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
 print '</td>';
 print '</tr>';
 $var = True;
 foreach ($prodcustprice->lines as $line) {
     print "<tr {$bc[$var]}>";
     $staticprod = new Product($db);
     $staticprod->fetch($line->fk_product);
     print "<td>" . $staticprod->getNomUrl(1) . "</td>";
     print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
     print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
     print '<td align="right">' . vatrate($line->tva_tx, true, $line->recuperableonly) . "</td>";
     print '<td align="right">' . price($line->price) . "</td>";
     print '<td align="right">' . price($line->price_ttc) . "</td>";
     print '<td align="right">' . price($line->price_min) . '</td>';
     print '<td align="right">' . price($line->price_min_ttc) . '</td>';
     // User
     $userstatic = new User($db);
     $userstatic->fetch($line->fk_user);
     print '<td align="right">';
     print $userstatic->getLoginUrl(1);
     print '</td>';
     // Todo Edit or delete button
     // Action
     if ($user->rights->produit->creer || $user->rights->service->creer) {
    // Add number of product when there is a filter on period
    if (count($arrayofuniqueproduct) == 1 && is_numeric($year)) {
        $productidselected = 0;
        foreach ($arrayofuniqueproduct as $key => $val) {
            $productidselected = $key;
            $productlabelselected = $val;
        }
        $datebefore = dol_get_first_day($year ? $year : strftime("%Y", time()), $month ? $month : 1, true);
        $dateafter = dol_get_last_day($year ? $year : strftime("%Y", time()), $month ? $month : 12, true);
        $balancebefore = $movement->calculateBalanceForProductBefore($productidselected, $datebefore);
        $balanceafter = $movement->calculateBalanceForProductBefore($productidselected, $dateafter);
        //print '<tr class="total"><td class="liste_total">';
        print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore, 'day', 'gmt'));
        //print '</td>';
        //print '<td class="liste_total" colspan="6" align="right">';
        print ': ' . $balancebefore;
        print "<br>\n";
        //print '</td></tr>';
        //print '<tr class="total"><td class="liste_total">';
        print $langs->trans("NbOfProductAfterPeriod", $productlabelselected, dol_print_date($dateafter, 'day', 'gmt'));
        //print '</td>';
        //print '<td class="liste_total" colspan="6" align="right">';
        print ': ' . $balanceafter;
        print "<br>\n";
        //print '</td></tr>';
    }
} else {
    dol_print_error($db);
}
llxFooter();
$db->close();
        $var = !$var;
        print "<tr " . $bc[$var] . ">";
        // Login
        print '<td>' . $sessionentry['login'] . '</td>';
        // ID
        print '<td align="left" class="nowrap">';
        if ("{$key}" == session_id()) {
            print $form->textwithpicto($key, $langs->trans("YourSession"));
        } else {
            print $key;
        }
        print '</td>';
        // Date creation
        print '<td align="left" class="nowrap">' . dol_print_date($sessionentry['creation'], '%Y-%m-%d %H:%M:%S') . '</td>';
        // Date modification
        print '<td align="left" class="nowrap">' . dol_print_date($sessionentry['modification'], '%Y-%m-%d %H:%M:%S') . '</td>';
        // Age
        print '<td>' . $sessionentry['age'] . '</td>';
        // Raw
        print '<td>' . dol_trunc($sessionentry['raw'], 40, 'middle') . '</td>';
        print '<td>&nbsp;</td>';
        print "</tr>\n";
        $i++;
    }
    if (count($listofsessions) == 0) {
        print '<tr><td colspan="6">' . $langs->trans("NoSessionFound", $savepath, $openbasedir) . '</td></tr>';
    }
    print "</table>";
} else {
    print $langs->trans("NoSessionListWithThisHandler");
}
Ejemplo n.º 25
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;
 }
Ejemplo n.º 26
0
/**	  	Return, in clear text, value of a number of seconds in days, hours and minutes
 *
 *    	@param      int		$iSecond		Number of seconds
 *    	@param      string	$format		    Output format (all: complete display, hour: displays only hours, min: displays only minutes, sec: displays only seconds, month: display month only, year: displays only year);
 *      @param      int		$lengthOfDay    Length of day (default 86400 seconds for 1 day, 28800 for 8 hour)
 *      @param      int		$lengthOfWeek   Length of week (default 7)
 *    	@return     sTime		 		 	Formated text of duration
 * 	                                		Example: 0 return 00:00, 3600 return 1:00, 86400 return 1d, 90000 return 1 Day 01:00
 */
function convertSecondToTime($iSecond, $format = 'all', $lengthOfDay = 86400, $lengthOfWeek = 7)
{
    global $langs;
    if (empty($lengthOfDay)) {
        $lengthOfDay = 86400;
    }
    // 1 day = 24 hours
    if (empty($lengthOfWeek)) {
        $lengthOfWeek = 7;
    }
    // 1 week = 7 days
    if ($format == 'all') {
        if ($iSecond === 0) {
            return '0';
        }
        // This is to avoid having 0 return a 12:00 AM for en_US
        $sTime = '';
        $sDay = 0;
        $sWeek = '';
        if ($iSecond >= $lengthOfDay) {
            for ($i = $iSecond; $i >= $lengthOfDay; $i -= $lengthOfDay) {
                $sDay++;
                $iSecond -= $lengthOfDay;
            }
            $dayTranslate = $langs->trans("Day");
            if ($iSecond >= $lengthOfDay * 2) {
                $dayTranslate = $langs->trans("Days");
            }
        }
        if ($lengthOfWeek < 7) {
            if ($sDay) {
                if ($sDay >= $lengthOfWeek) {
                    $sWeek = (int) (($sDay - $sDay % $lengthOfWeek) / $lengthOfWeek);
                    $sDay = $sDay % $lengthOfWeek;
                    $weekTranslate = $langs->trans("DurationWeek");
                    if ($sWeek >= 2) {
                        $weekTranslate = $langs->trans("DurationWeeks");
                    }
                    $sTime .= $sWeek . ' ' . $weekTranslate . ' ';
                }
                /*                if ($sDay>0)
                                {
                                    $dayTranslate = $langs->trans("Day");
                                    if ($sDay > 1) $dayTranslate = $langs->trans("Days");
                                    $sTime.=$sDay.' '.$dayTranslate.' ';
                                }
                */
            }
        }
        if ($sDay > 0) {
            $dayTranslate = $langs->trans("Day");
            if ($sDay > 1) {
                $dayTranslate = $langs->trans("Days");
            }
            $sTime .= $sDay . ' ' . $dayTranslate . ' ';
        }
        //		if ($sDay) $sTime.=$sDay.' '.$dayTranslate.' ';
        if ($iSecond || empty($sDay)) {
            $sTime .= dol_print_date($iSecond, 'hourduration', true);
        }
    } else {
        if ($format == 'hour') {
            $sTime = dol_print_date($iSecond, '%H', true);
        } else {
            if ($format == 'min') {
                $sTime = dol_print_date($iSecond, '%M', true);
            } else {
                if ($format == 'sec') {
                    $sTime = dol_print_date($iSecond, '%S', true);
                } else {
                    if ($format == 'month') {
                        $sTime = dol_print_date($iSecond, '%m', true);
                    } else {
                        if ($format == 'year') {
                            $sTime = dol_print_date($iSecond, '%Y', true);
                        }
                    }
                }
            }
        }
    }
    return trim($sTime);
}
Ejemplo n.º 27
0
 $projectstatic->ref = $obj->ref;
 $projectstatic->title = $obj->title;
 print $projectstatic->getNomUrl(1, '', 16);
 //print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$obj->projectid.'">'.$obj->title.'</a>';
 print '</td>';
 print '<td>';
 if (!empty($obj->taskid)) {
     $tasktmp->id = $obj->taskid;
     $tasktmp->ref = $obj->label;
     print $tasktmp->getNomUrl(1, 'withproject');
 } else {
     print $langs->trans("NoTasks");
 }
 print '</td>';
 print '<td>' . dol_print_date($db->jdate($obj->dateo), 'day') . '</td>';
 print '<td>' . dol_print_date($db->jdate($obj->datee), 'day') . '</td>';
 print '<td align="right"><a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $obj->taskid . '&withproject=1">';
 print convertSecondToTime($obj->planned_workload, 'all');
 print '</a></td>';
 print '<td align="right">';
 print $obj->taskid > 0 ? $obj->progress . '%' : '';
 print '</td>';
 print '<td align="right"><a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $obj->taskid . '&withproject=1">';
 print convertSecondToTime($obj->timespent, 'all');
 print '</a></td>';
 print '<td align="right">';
 if (!empty($obj->taskid)) {
     if (empty($obj->planned_workload) > 0) {
         $percentcompletion = $langs->trans("WorkloadNotDefined");
     } else {
         $percentcompletion = intval($obj->duration_effective * 100 / $obj->planned_workload) . '%';
Ejemplo n.º 28
0
/**
 * Get list of products for a category
 *
 * @param	array		$authentication		Array of authentication information
 * @param	array		$id					Category id
 * @param	$lang		$lang				Force lang
 * @return	array							Array result
 */
function getProductsForCategory($authentication, $id, $lang = '')
{
    global $db, $conf, $langs;
    $langcode = $lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
    $langs->setDefaultLang($langcode);
    dol_syslog("Function: getProductsForCategory login="******" id=" . $id);
    if ($authentication['entity']) {
        $conf->entity = $authentication['entity'];
    }
    $objectresp = array();
    $errorcode = '';
    $errorlabel = '';
    $error = 0;
    $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
    if (!$error && !$id) {
        $error++;
        $errorcode = 'BAD_PARAMETERS';
        $errorlabel = "Parameter id must be provided.";
    }
    if (!$error) {
        $langcode = $lang ? $lang : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
        $langs->setDefaultLang($langcode);
        $fuser->getrights();
        if ($fuser->rights->produit->lire) {
            $categorie = new Categorie($db);
            $result = $categorie->fetch($id);
            if ($result > 0) {
                $table = "product";
                $field = "product";
                $sql = "SELECT fk_" . $field . " FROM " . MAIN_DB_PREFIX . "categorie_" . $table;
                $sql .= " WHERE fk_categorie = " . $id;
                $sql .= " ORDER BY fk_" . $field . " ASC";
                dol_syslog("getProductsForCategory get id of product into category", LOG_DEBUG);
                $res = $db->query($sql);
                if ($res) {
                    while ($rec = $db->fetch_array($res)) {
                        $obj = new Product($db);
                        $obj->fetch($rec['fk_' . $field]);
                        $iProduct = 0;
                        if ($obj->status > 0) {
                            $dir = !empty($conf->product->dir_output) ? $conf->product->dir_output : $conf->service->dir_output;
                            $pdir = get_exdir($obj->id, 2) . $obj->id . "/photos/";
                            $dir = $dir . '/' . $pdir;
                            $products[] = array('id' => $obj->id, 'ref' => $obj->ref, 'ref_ext' => $obj->ref_ext, 'label' => !empty($obj->multilangs[$langs->defaultlang]["label"]) ? $obj->multilangs[$langs->defaultlang]["label"] : $obj->label, 'description' => !empty($obj->multilangs[$langs->defaultlang]["description"]) ? $obj->multilangs[$langs->defaultlang]["description"] : $obj->description, 'date_creation' => dol_print_date($obj->date_creation, 'dayhourrfc'), 'date_modification' => dol_print_date($obj->date_modification, 'dayhourrfc'), 'note' => !empty($obj->multilangs[$langs->defaultlang]["note"]) ? $obj->multilangs[$langs->defaultlang]["note"] : $obj->note, 'status_tosell' => $obj->status, 'status_tobuy' => $obj->status_buy, 'type' => $obj->type, 'barcode' => $obj->barcode, 'barcode_type' => $obj->barcode_type, 'country_id' => $obj->country_id > 0 ? $obj->country_id : '', 'country_code' => $obj->country_code, 'custom_code' => $obj->customcode, 'price_net' => $obj->price, 'price' => $obj->price_ttc, 'vat_rate' => $obj->tva_tx, 'price_base_type' => $obj->price_base_type, 'stock_real' => $obj->stock_reel, 'stock_alert' => $obj->seuil_stock_alerte, 'pmp' => $obj->pmp, 'import_key' => $obj->import_key, 'dir' => $pdir, 'images' => $obj->liste_photos($dir, $nbmax = 10));
                            //Retreive all extrafield for thirdsparty
                            // fetch optionals attributes and labels
                            $extrafields = new ExtraFields($db);
                            $extralabels = $extrafields->fetch_name_optionals_label('product', true);
                            //Get extrafield values
                            $product->fetch_optionals($obj->id, $extralabels);
                            foreach ($extrafields->attribute_label as $key => $label) {
                                $products[$iProduct] = array_merge($products[$iProduct], array('options_' . $key => $product->array_options['options_' . $key]));
                            }
                            $iProduct++;
                        }
                    }
                    // Retour
                    $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'products' => $products);
                } else {
                    $errorcode = 'NORECORDS_FOR_ASSOCIATION';
                    $errorlabel = 'No products associated' . $sql;
                    $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
                    dol_syslog("getProductsForCategory:: " . $c->error, LOG_DEBUG);
                }
            } else {
                $error++;
                $errorcode = 'NOT_FOUND';
                $errorlabel = 'Object not found for id=' . $id;
            }
        } else {
            $error++;
            $errorcode = 'PERMISSION_DENIED';
            $errorlabel = 'User does not have permission for this request';
        }
    }
    if ($error) {
        $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
    }
    return $objectresp;
}
Ejemplo n.º 29
0
    print_liste_field_titre($langs->trans("WithdrawalsReceipts"), "bons.php", "p.ref", '', '', 'class="liste_titre"');
    print_liste_field_titre($langs->trans("Date"), "bons.php", "p.datec", "", "", 'class="liste_titre" align="center"');
    print '<td class="liste_titre" align="right">' . $langs->trans("Amount") . '</td>';
    print '</tr>';
    print '<tr class="liste_titre">';
    print '<form action="bons.php" method="GET">';
    print '<td class="liste_titre"><input type="text" class="flat" name="search_ligne" value="' . $search_line . '" size="10"></td>';
    print '<td class="liste_titre">&nbsp;</td>';
    print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '"></td>';
    print '</form>';
    print '</tr>';
    $var = True;
    while ($i < min($num, $conf->liste_limit)) {
        $obj = $db->fetch_object($result);
        $var = !$var;
        print "<tr " . $bc[$var] . "><td>";
        print $bon->LibStatut($obj->statut, 2);
        print "&nbsp;";
        print '<a href="fiche.php?id=' . $obj->rowid . '">' . $obj->ref . "</a></td>\n";
        print '<td align="center">' . dol_print_date($db->jdate($obj->datec), 'day') . "</td>\n";
        print '<td align="right">' . price($obj->amount) . "</td>\n";
        print "</tr>\n";
        $i++;
    }
    print "</table>";
    $db->free($result);
} else {
    dol_print_error($db);
}
$db->close();
llxFooter();
 /**
  *  Load data for box to show them later
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 5)
 {
     global $user, $langs, $db, $conf;
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
     $contractstatic = new Contrat($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLastContracts", $max));
     if ($user->rights->contrat->lire) {
         $sql = "SELECT s.nom, s.rowid as socid,";
         $sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "contrat as c";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE c.fk_soc = s.rowid";
         $sql .= " AND c.entity = " . $conf->entity;
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
         }
         $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC ";
         $sql .= $db->plimit($max, 0);
         $resql = $db->query($sql);
         if ($resql) {
             $num = $db->num_rows($resql);
             $now = dol_now();
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($resql);
                 $datec = $db->jdate($objp->datec);
                 $dateterm = $db->jdate($objp->fin_validite);
                 $dateclose = $db->jdate($objp->date_cloture);
                 $late = '';
                 $contractstatic->statut = $objp->fk_statut;
                 $contractstatic->id = $objp->rowid;
                 $result = $contractstatic->fetch_lines();
                 // fin_validite is no more on contract but on services
                 // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/contrat/fiche.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref ? $objp->ref : $objp->rowid, 'text2' => $late, 'url' => DOL_URL_ROOT . "/contrat/fiche.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($objp->nom, 40), 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datec, 'day'));
                 $this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"', 'text' => $contractstatic->getLibStatut(6), 'asis' => 1);
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedContracts"));
             }
             $db->free($resql);
         } else {
             $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
         }
     } else {
         $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }