public function get_uid($id)
 {
     $uid = $id;
     if (!isset($_SESSION[UID . 'USER']['id']) && !$id) {
         //not passed id and not logged in
         header('Location: ' . User::getLoginUrl());
         exit;
     } else {
         if (isset($_SESSION[UID . 'USER']['id']) && !$id) {
             //not passed id but is logged in
             $uid = intval($_SESSION[UID . 'USER']['id']);
         }
     }
     /*else {
     
                 //passed id but not logged in
                 //or passed id and logged in , yet preference given to passed id
                 //$uid = $id; //already done in first statement
             }*/
     return $uid;
 }
Example #2
0
     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";
     print '<td>&nbsp;</td>';
     print "</tr>\n";
     $total += $objp->total_ht;
     $subtotal += $objp->total_ht;
     $i++;
 }
 if ($total > 0) {
     if ($num < $limit) {
         $var = !$var;
         print '<tr class="liste_total"><td align="left">' . $langs->trans("TotalHT") . '</td>';
Example #3
0
 $cumul_commission_service = 0;
 if ($num > 0) {
     $var = True;
     while ($i < $num && $i < $conf->liste_limit) {
         $objp = $db->fetch_object($result);
         $var = !$var;
         print "<tr {$bc[$var]}>";
         if ($agentid > 0) {
             $companystatic->id = $objp->socid;
             $companystatic->nom = $objp->nom;
             $companystatic->client = $objp->client;
             print "<td>" . $companystatic->getNomUrl(1, 'customer') . "</td>\n";
         } else {
             $userstatic->id = $objp->agent;
             $userstatic->login = $objp->login;
             print "<td>" . $userstatic->getLoginUrl(1) . "</td>\n";
         }
         // product commission
         $productCommissionRate = !empty($conf->global->PRODUCT_COMMISSION_RATE) ? $conf->global->PRODUCT_COMMISSION_RATE : 0;
         $productBase = !empty($objp->productBase) ? $objp->productBase : 0;
         $productCommission = !empty($productBase) ? $productCommissionRate * $productBase / 100 : 0;
         print "<td align=\"right\">" . price($productBase) . "</td>\n";
         print "<td align=\"right\">" . price($productCommissionRate) . "</td>\n";
         print "<td align=\"right\">" . price($productCommission) . "</td>\n";
         // service commission
         $serviceCommissionRate = !empty($conf->global->SERVICE_COMMISSION_RATE) ? $conf->global->SERVICE_COMMISSION_RATE : 0;
         $serviceBase = !empty($objp->serviceBase) ? $objp->serviceBase : 0;
         $serviceCommission = !empty($serviceBase) ? $serviceCommissionRate * $serviceBase / 100 : 0;
         print "<td align=\"right\">" . price($serviceBase) . "</td>\n";
         print "<td align=\"right\">" . price($serviceCommissionRate) . "</td>\n";
         print "<td align=\"right\">" . price($serviceCommission) . "</td>\n";
Example #4
0
 }
 if (!empty($conf->contrat->enabled)) {
     print '<tr><td>' . $langs->trans("ContactForContracts") . '</td><td colspan="3">';
     print $object->ref_contrat ? $object->ref_contrat : $langs->trans("NoContactForAnyContract");
     print '</td></tr>';
 }
 if (!empty($conf->facture->enabled)) {
     print '<tr><td>' . $langs->trans("ContactForInvoices") . '</td><td colspan="3">';
     print $object->ref_facturation ? $object->ref_facturation : $langs->trans("NoContactForAnyInvoice");
     print '</td></tr>';
 }
 print '<tr><td>' . $langs->trans("DolibarrLogin") . '</td><td colspan="3">';
 if ($object->user_id) {
     $dolibarr_user = new User($db);
     $result = $dolibarr_user->fetch($object->user_id);
     print $dolibarr_user->getLoginUrl(1);
 } else {
     print $langs->trans("NoDolibarrAccess");
 }
 print '</td></tr>';
 print '<tr><td>';
 print $langs->trans("ExportCardToFormat") . '</td><td colspan="3">';
 print '<a href="' . DOL_URL_ROOT . '/contact/vcard.php?id=' . $object->id . '">';
 print img_picto($langs->trans("VCard"), 'vcard.png') . ' ';
 print $langs->trans("VCard");
 print '</a>';
 print '</td></tr>';
 print "</table>";
 print dol_fiche_end();
 // Barre d'actions
 print '<div class="tabsAction">';
    /**
     *  Set content of ->tpl array, to use into template
     *
     *  @param	string		$action    Type of action
     *  @param	int			$id			Id
     *  @return	string					HTML output
     */
    function assign_values(&$action, $id)
    {
        global $conf, $langs, $user, $canvas;
        global $form, $formcompany, $objsoc;
        if ($action == 'add' || $action == 'update') {
            $this->assign_post();
        }
        foreach ($this->object as $key => $value) {
            $this->tpl[$key] = $value;
        }
        $this->tpl['error'] = $this->error;
        $this->tpl['errors'] = $this->errors;
        if ($action == 'create' || $action == 'edit') {
            if ($conf->use_javascript_ajax) {
                $this->tpl['ajax_selectcountry'] = "\n" . '<script type="text/javascript" language="javascript">
				jQuery(document).ready(function () {
						jQuery("#selectcountry_id").change(function() {
							document.formsoc.action.value="' . $action . '";
							document.formsoc.canvas.value="' . $canvas . '";
							document.formsoc.submit();
						});
					})
				</script>' . "\n";
            }
            if (is_object($objsoc) && $objsoc->id > 0) {
                $this->tpl['company'] = $objsoc->getNomUrl(1);
                $this->tpl['company_id'] = $objsoc->id;
            } else {
                $this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1);
            }
            // Civility
            $this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id);
            // Predefined with third party
            if (isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) {
                if (dol_strlen(trim($this->object->address)) == 0) {
                    $this->tpl['address'] = $objsoc->address;
                }
                if (dol_strlen(trim($this->object->zip)) == 0) {
                    $this->object->zip = $objsoc->zip;
                }
                if (dol_strlen(trim($this->object->town)) == 0) {
                    $this->object->town = $objsoc->town;
                }
                if (dol_strlen(trim($this->object->phone_pro)) == 0) {
                    $this->object->phone_pro = $objsoc->phone;
                }
                if (dol_strlen(trim($this->object->fax)) == 0) {
                    $this->object->fax = $objsoc->fax;
                }
                if (dol_strlen(trim($this->object->email)) == 0) {
                    $this->object->email = $objsoc->email;
                }
            }
            // Zip
            $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
            // Town
            $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
            if (dol_strlen(trim($this->object->country_id)) == 0) {
                $this->object->country_id = $objsoc->country_id;
            }
            // Country
            $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
            $countrynotdefined = $langs->trans("ErrorSetACountryFirst") . ' (' . $langs->trans("SeeAbove") . ')';
            if ($user->admin) {
                $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
            }
            // State
            if ($this->object->country_id) {
                $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement, $this->object->country_code);
            } else {
                $this->tpl['select_state'] = $countrynotdefined;
            }
            // Public or private
            $selectarray = array('0' => $langs->trans("ContactPublic"), '1' => $langs->trans("ContactPrivate"));
            $this->tpl['select_visibility'] = $form->selectarray('priv', $selectarray, $this->object->priv, 0);
        }
        if ($action == 'view' || $action == 'edit' || $action == 'delete') {
            // Emailing
            if (!empty($conf->mailing->enabled)) {
                $langs->load("mails");
                $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
            }
            // Linked element
            $this->tpl['contact_element'] = array();
            $i = 0;
            $this->object->load_ref_elements();
            if (!empty($conf->commande->enabled)) {
                $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForOrders");
                $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_commande ? $this->object->ref_commande : $langs->trans("NoContactForAnyOrder");
                $i++;
            }
            if (!empty($conf->propal->enabled)) {
                $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForProposals");
                $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_propal ? $this->object->ref_propal : $langs->trans("NoContactForAnyProposal");
                $i++;
            }
            if (!empty($conf->contrat->enabled)) {
                $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForContracts");
                $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_contrat ? $this->object->ref_contrat : $langs->trans("NoContactForAnyContract");
                $i++;
            }
            if (!empty($conf->facture->enabled)) {
                $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForInvoices");
                $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_facturation ? $this->object->ref_facturation : $langs->trans("NoContactForAnyInvoice");
                $i++;
            }
            // Dolibarr user
            if ($this->object->user_id) {
                $dolibarr_user = new User($this->db);
                $result = $dolibarr_user->fetch($this->object->user_id);
                $this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
            } else {
                $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
            }
        }
        if ($action == 'view' || $action == 'delete') {
            $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id');
            if ($this->object->socid > 0) {
                $objsoc = new Societe($this->db);
                $objsoc->fetch($this->object->socid);
                $this->tpl['company'] = $objsoc->getNomUrl(1);
            } else {
                $this->tpl['company'] = $langs->trans("ContactNotLinkedToCompany");
            }
            $this->tpl['civility'] = $this->object->getCivilityLabel();
            $this->tpl['address'] = dol_nl2br($this->object->address);
            $this->tpl['zip'] = $this->object->zip ? $this->object->zip . '&nbsp;' : '';
            $img = picto_from_langcode($this->object->country_code);
            $this->tpl['country'] = ($img ? $img . ' ' : '') . $this->object->country;
            $this->tpl['phone_pro'] = dol_print_phone($this->object->phone_pro, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
            $this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
            $this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
            $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX');
            $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
            $this->tpl['visibility'] = $this->object->LibPubPriv($this->object->priv);
            $this->tpl['note'] = nl2br($this->object->note);
        }
        if ($action == 'create_user') {
            // Full firstname and lastname separated with a dot : firstname.lastname
            include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
            require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
            $login = dol_buildlogin($this->object->lastname, $this->object->firstname);
            $generated_password = getRandomPassword(false);
            $password = $generated_password;
            // Create a form array
            $formquestion = array(array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password));
            $this->tpl['action_create_user'] = $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $this->object->id, $langs->trans("CreateDolibarrLogin"), $langs->trans("ConfirmCreateContact"), "confirm_create_user", $formquestion, 'no');
        }
    }
 public function ajaxShowPresent($request, $response)
 {
     /*{{{*/
     //获取有数据的分类
     $response->validPresentCates = PresentClient::getInstance()->getValidPresentCateList();
     $patientId = $request->patientid;
     $response->patientId = $patientId;
     if ($this->user->isNull()) {
         $response->redirectUrl = User::getLoginUrl();
         return;
     }
     list($canSend, $errorMsg) = $this->canSendPresent($patientId);
     $response->canSend = $canSend;
     $response->errorMsg = $errorMsg;
     if (false == $canSend) {
         return;
     }
     //先看礼物后选  过来的firstlook by 重新选择礼物
     $response->firstLook = $request->getRequest('firstlook', false);
     list($featAmount, $heartImgHtml) = ScoreClient::getInstance()->showFlagsforPage($this->space->user->id);
     //爱心图片
     $response->heartImgHtml = $heartImgHtml;
     //爱心值
     $response->featAmount = $featAmount;
     /********开始:处理未支付的订单(选择了赠送礼物,但是从付费页面跳出去了,就会生成一个未付费订单,页面会显示立即取消,重选礼物)*******/
     $presentOrder = PresentClient::getInstance()->getValidUnpaidPresentOrder($this->space->id, $patientId, $this->user->id);
     $new = $request->new;
     if (false == $presentOrder->isNull()) {
         if (false == empty($new) || $presentOrder->present->isExpired()) {
             //点击重新选择礼物时,会传来参数new=1
             PresentClient::getInstance()->setPresentOrderUnvalid($presentOrder->id);
         } else {
             $response->presentOrder = $presentOrder;
             $response->present = $presentOrder->present;
             $response->wish = $presentOrder->wish;
             $response->presentId = $presentOrder->present->id;
             if (false == $this->user->isNull()) {
                 $flows = FlowClient::getInstance()->getFlowListByUser($this->user->id, array('status' => DoctorPatientRef::STATUS_INIT));
                 $otherDoctorFlows = array();
                 foreach ($flows as $flow) {
                     if ($flow->spaceid != $this->space->id) {
                         array_push($otherDoctorFlows, $flow);
                     }
                 }
                 $response->otherDoctorFlows = $otherDoctorFlows;
             }
             $patient = DAL::get()->find('patient', $patientId);
             $userId = empty($patientId) ? $this->user->id : $patient->user->id;
             $response->leftAmount = ScoreClient::getInstance()->getIntegralAmount($userId);
             return 'ajaxapplypresent';
         }
     }
     /********结束:处理未支付的订单*******/
     $page = $request->getRequest('page', 1);
     $response->page = $page;
     $pageSize = 4;
     $options = array();
     $presentCategoryId = $request->getRequest('categoryid', 0);
     $options['categoryid'] = $presentCategoryId;
     $response->categoryId = $presentCategoryId;
     $result = PresentClient::getInstance()->showPresentList4Front($page, $pageSize, $options);
     $response->presentList = $result['presents'];
     $response->presentSoldCounts = array();
     //(false == empty($result['presents'])) ? PresentClient::getInstance()->getPresentCountOfSold(array_keys($result['presents'])) : 0 ;
     $pageInfo = $result['pageInfo'];
     $response->pagelink = PageNav::getNavLink(PageNav::getPageNavTemplateForSpace('/api/present/ajaxshowpresent?patientid=' . $patientId . '&categoryid=' . $presentCategoryId . '&uname=' . $this->space->user->name . '&page=', 2, 3, 1, false), $pageInfo['nowpage'], $pageInfo['pagesize'], $pageInfo['total'], false);
 }
/**
 *    	Show html area with actions done
 *
 * 		@param	Conf		$conf		Object conf
 * 		@param	Translate	$langs		Object langs
 * 		@param	DoliDB		$db			Object db
 * 		@param	Object		$object		Object third party or member
 * 		@param	Contact		$objcon		Object contact
 *      @param  int			$noprint    Return string but does not output it
 *      @return	mixed					Return html part or void if noprint is 1
 * TODO change function to be able to list event linked to an object.
 */
function show_actions_done($conf, $langs, $db, $object, $objcon = '', $noprint = 0)
{
    global $bc, $user;
    // Check parameters
    if (!is_object($object)) {
        dol_print_error('', 'BadParameter');
    }
    $out = '';
    $histo = array();
    $numaction = 0;
    $now = dol_now('tzuser');
    if (!empty($conf->agenda->enabled)) {
        // Recherche histo sur actioncomm
        $sql = "SELECT a.id, a.label,";
        $sql .= " a.datep as dp,";
        $sql .= " a.datep2 as dp2,";
        $sql .= " a.note, a.percent,";
        $sql .= " a.fk_element, a.elementtype,";
        $sql .= " a.fk_user_author, a.fk_contact,";
        $sql .= " c.code as acode, c.libelle,";
        $sql .= " u.login, u.rowid as user_id";
        if (get_class($object) == 'Adherent') {
            $sql .= ", m.lastname, m.firstname";
        }
        if (get_class($object) == 'Societe') {
            $sql .= ", sp.lastname, sp.firstname";
        }
        $sql .= " FROM " . MAIN_DB_PREFIX . "c_actioncomm as c, " . MAIN_DB_PREFIX . "user as u, " . MAIN_DB_PREFIX . "actioncomm as a";
        if (get_class($object) == 'Adherent') {
            $sql .= ", " . MAIN_DB_PREFIX . "adherent as m";
        }
        if (get_class($object) == 'Societe') {
            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople as sp ON a.fk_contact = sp.rowid";
        }
        $sql .= " WHERE u.rowid = a.fk_user_author";
        $sql .= " AND a.entity IN (" . getEntity('agenda', 1) . ")";
        if (get_class($object) == 'Adherent') {
            $sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
        }
        if (get_class($object) == 'Adherent' && $object->id) {
            $sql .= " AND a.fk_element = " . $object->id;
        }
        if (get_class($object) == 'Societe' && $object->id) {
            $sql .= " AND a.fk_soc = " . $object->id;
        }
        if (is_object($objcon) && $objcon->id) {
            $sql .= " AND a.fk_contact = " . $objcon->id;
        }
        $sql .= " AND c.id=a.fk_action";
        $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '" . $db->idate($now) . "'))";
        $sql .= " ORDER BY a.datep DESC, a.id DESC";
        dol_syslog("company.lib::show_actions_done sql=" . $sql, LOG_DEBUG);
        $resql = $db->query($sql);
        if ($resql) {
            $i = 0;
            $num = $db->num_rows($resql);
            $var = true;
            while ($i < $num) {
                $obj = $db->fetch_object($resql);
                $histo[$numaction] = array('type' => 'action', 'id' => $obj->id, 'datestart' => $db->jdate($obj->dp), 'date' => $db->jdate($obj->dp2), 'note' => $obj->label, 'percent' => $obj->percent, 'acode' => $obj->acode, 'libelle' => $obj->libelle, 'userid' => $obj->user_id, 'login' => $obj->login, 'contact_id' => $obj->fk_contact, 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'fk_element' => $obj->fk_element, 'elementtype' => $obj->elementtype);
                $numaction++;
                $i++;
            }
        } else {
            dol_print_error($db);
        }
    }
    if (!empty($conf->mailing->enabled) && !empty($objcon->email)) {
        $langs->load("mails");
        // Recherche histo sur mailing
        $sql = "SELECT m.rowid as id, mc.date_envoi as da, m.titre as note, '100' as percentage,";
        $sql .= " 'AC_EMAILING' as acode,";
        $sql .= " u.rowid as user_id, u.login";
        // User that valid action
        $sql .= " FROM " . MAIN_DB_PREFIX . "mailing as m, " . MAIN_DB_PREFIX . "mailing_cibles as mc, " . MAIN_DB_PREFIX . "user as u";
        $sql .= " WHERE mc.email = '" . $db->escape($objcon->email) . "'";
        // Search is done on email.
        $sql .= " AND mc.statut = 1";
        $sql .= " AND u.rowid = m.fk_user_valid";
        $sql .= " AND mc.fk_mailing=m.rowid";
        $sql .= " ORDER BY mc.date_envoi DESC, m.rowid DESC";
        dol_syslog("company.lib::show_actions_done sql=" . $sql, LOG_DEBUG);
        $resql = $db->query($sql);
        if ($resql) {
            $i = 0;
            $num = $db->num_rows($resql);
            $var = true;
            while ($i < $num) {
                $obj = $db->fetch_object($resql);
                $histo[$numaction] = array('type' => 'mailing', 'id' => $obj->id, 'date' => $db->jdate($obj->da), 'note' => $obj->note, 'percent' => $obj->percentage, 'acode' => $obj->acode, 'userid' => $obj->user_id, 'login' => $obj->login);
                $numaction++;
                $i++;
            }
            $db->free($resql);
        } else {
            dol_print_error($db);
        }
    }
    if (!empty($conf->agenda->enabled) || !empty($conf->mailing->enabled) && !empty($objcon->email)) {
        require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
        require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
        require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
        require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
        $actionstatic = new ActionComm($db);
        $userstatic = new User($db);
        $contactstatic = new Contact($db);
        // TODO uniformize
        $propalstatic = new Propal($db);
        $orderstatic = new Commande($db);
        $facturestatic = new Facture($db);
        $out .= "\n";
        $out .= '<table class="noborder" width="100%">';
        $out .= '<tr class="liste_titre">';
        $out .= '<td colspan="2">';
        if (get_class($object) == 'Societe') {
            $out .= '<a href="' . DOL_URL_ROOT . '/comm/action/listactions.php?socid=' . $object->id . '&amp;status=done">';
        }
        $out .= $langs->trans("ActionsDoneShort");
        if (get_class($object) == 'Societe') {
            $out .= '</a>';
        }
        $out .= '</td>';
        $out .= '<td colspan="5" align="right">';
        $permok = $user->rights->agenda->myactions->create;
        if ((!empty($object->id) || !empty($objcon->id)) && $permok) {
            $out .= '<a href="' . DOL_URL_ROOT . '/comm/action/fiche.php?action=create';
            if (get_class($object) == 'Societe') {
                $out .= '&amp;socid=' . $object->id;
            }
            $out .= (!empty($objcon->id) ? '&amp;contactid=' . $objcon->id : '') . '&amp;backtopage=1&amp;percentage=-1">';
            $out .= $langs->trans("AddAnAction") . ' ';
            $out .= img_picto($langs->trans("AddAnAction"), 'filenew');
            $out .= "</a>";
        }
        $out .= '</td>';
        $out .= '</tr>';
        foreach ($histo as $key => $value) {
            $var = !$var;
            $out .= "<tr " . $bc[$var] . ">";
            // Champ date
            $out .= '<td width="120" class="nowrap">';
            if ($histo[$key]['date']) {
                $out .= dol_print_date($histo[$key]['date'], 'dayhour');
            } else {
                if ($histo[$key]['datestart']) {
                    $out .= dol_print_date($histo[$key]['datestart'], 'dayhour');
                }
            }
            $out .= "</td>\n";
            // Picto
            $out .= '<td width="16">&nbsp;</td>';
            // Action
            $out .= '<td>';
            if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
                $actionstatic->type_code = $histo[$key]['acode'];
                $transcode = $langs->trans("Action" . $histo[$key]['acode']);
                $libelle = $transcode != "Action" . $histo[$key]['acode'] ? $transcode : $histo[$key]['libelle'];
                //$actionstatic->libelle=$libelle;
                $actionstatic->libelle = $histo[$key]['note'];
                $actionstatic->id = $histo[$key]['id'];
                $out .= $actionstatic->getNomUrl(1, 40);
            }
            if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
                $out .= '<a href="' . DOL_URL_ROOT . '/comm/mailing/fiche.php?id=' . $histo[$key]['id'] . '">' . img_object($langs->trans("ShowEMailing"), "email") . ' ';
                $transcode = $langs->trans("Action" . $histo[$key]['acode']);
                $libelle = $transcode != "Action" . $histo[$key]['acode'] ? $transcode : 'Send mass mailing';
                $out .= dol_trunc($libelle, 40);
            }
            $out .= '</td>';
            // Title of event
            //$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';
            // Objet lie
            // TODO uniformize
            $out .= '<td>';
            if (isset($histo[$key]['elementtype'])) {
                if ($histo[$key]['elementtype'] == 'propal' && !empty($conf->propal->enabled)) {
                    $propalstatic->ref = $langs->trans("ProposalShort");
                    $propalstatic->id = $histo[$key]['fk_element'];
                    $out .= $propalstatic->getNomUrl(1);
                } elseif ($histo[$key]['elementtype'] == 'commande' && !empty($conf->commande->enabled)) {
                    $orderstatic->ref = $langs->trans("Order");
                    $orderstatic->id = $histo[$key]['fk_element'];
                    $out .= $orderstatic->getNomUrl(1);
                } elseif ($histo[$key]['elementtype'] == 'facture' && !empty($conf->facture->enabled)) {
                    $facturestatic->ref = $langs->trans("Invoice");
                    $facturestatic->id = $histo[$key]['fk_element'];
                    $facturestatic->type = $histo[$key]['ftype'];
                    $out .= $facturestatic->getNomUrl(1, 'compta');
                } else {
                    $out .= '&nbsp;';
                }
            } else {
                $out .= '&nbsp;';
            }
            $out .= '</td>';
            // Contact pour cette action
            if (!empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) {
                $contactstatic->lastname = $histo[$key]['lastname'];
                $contactstatic->firstname = $histo[$key]['firstname'];
                $contactstatic->id = $histo[$key]['contact_id'];
                $out .= '<td width="120">' . $contactstatic->getNomUrl(1, '', 10) . '</td>';
            } else {
                $out .= '<td>&nbsp;</td>';
            }
            // Auteur
            $out .= '<td class="nowrap" width="80">';
            $userstatic->id = $histo[$key]['userid'];
            $userstatic->login = $histo[$key]['login'];
            $out .= $userstatic->getLoginUrl(1);
            $out .= '</td>';
            // Statut
            $out .= '<td class="nowrap" width="20">' . $actionstatic->LibStatut($histo[$key]['percent'], 3) . '</td>';
            $out .= "</tr>\n";
            $i++;
        }
        $out .= "</table>\n";
        $out .= "<br>\n";
    }
    if ($noprint) {
        return $out;
    } else {
        print $out;
    }
}
                 '<a href="' . $href . '">'.
                 img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref.
                 '</a></td>';

            // Company
            $href = DOL_URL_ROOT . '/fourn/card.php?socid=' . $obj->socid;
            print '<td>'.
                 '<a href="' . $href .'">'.
                 img_object($langs->trans('ShowCompany'), 'company'). ' '.
                 $obj->name . '</a></td>';

            // Author
            $userstatic->id = $obj->fk_user_author;
            $userstatic->login = $obj->login;
            if ($userstatic->id) {
                $txt = $userstatic->getLoginUrl(1);
            } else {
                $txt =  '&nbsp;';
            }
            print '<td>'.
                 $txt.
                 '</td>'.
            // Amount
                 '<td>'.
                 price($obj->total_ttc).
                 '</td>';

            // Date
            if ($obj->dc) {
                $date =  dol_print_date($db->jdate($obj->dc), 'dayhour');
            } else {
Example #9
0
			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";

			print '<td>&nbsp;</td>';

			print "</tr>\n";

			$total = $total + $objp->total_ht;
			$subtotal = $subtotal + $objp->total_ht;

			$i++;
		}
		print '</table>';
Example #10
0
 if ($resql) {
     $var = true;
     $num = $db->num_rows($resql);
     // Boucle sur chaque facture
     for ($i = 0; $i < $num; $i++) {
         $objf = $db->fetch_object($resql);
         $fac = new Facture($db);
         $ret = $fac->fetch($objf->facid);
         if ($ret < 0) {
             print $fac->error . "<br>";
             continue;
         }
         $totalpaye = $fac->getSommePaiement();
         $userstatic->id = $objf->userid;
         $userstatic->login = $objf->login;
         $TData[] = array('date' => $fac->date, 'link' => $fac->getNomUrl(1), 'status' => $fac->getLibStatut(2, $totalpaye), 'amount' => $fac->total_ttc, 'author' => $userstatic->getLoginUrl(1));
         $TDataSort[] = $fac->date;
         // Paiements
         $sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
         $sql .= " p.fk_user_creat, u.login, u.rowid as userid";
         $sql .= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf,";
         $sql .= " " . MAIN_DB_PREFIX . "paiement as p";
         $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u ON p.fk_user_creat = u.rowid";
         $sql .= " WHERE pf.fk_paiement = p.rowid";
         $sql .= " AND p.entity = " . $conf->entity;
         $sql .= " AND pf.fk_facture = " . $fac->id;
         $sql .= " ORDER BY p.datep ASC";
         $resqlp = $db->query($sql);
         if ($resqlp) {
             $nump = $db->num_rows($resqlp);
             $j = 0;