function get_statuses($param)
{
    $since_dt = get_date_range($param);
    $offset = $param->offset;
    $graph_url = $param->graph_url . $param->connection . '?access_token=' . $param->token . "&since={$since_t->since}&limit={$param->limit}&offset={$offset}";
    $fb = get_graphapi_data($graph_url);
    $fbdata = $fb->data;
    $cdate = date('Y-n-j H:i:s');
    if ($fbdata) {
        logme('updating status');
    }
    echo "\nstart...";
    print_r($fbdata);
    $sql_insert = "INSERT INTO {$param->table_name}(facebook_id,connection,fb_dataid,fbdata,fbdata_postedtime,created_date) VALUES ";
    while ($fbdata) {
        $sql = '';
        $counter = 0;
        foreach ($fbdata as $data) {
            $counter++;
            echo "\nplease wait..processing for... {$counter}";
            //check for duplicate, just in case
            $sql_select = "SELECT facebook_id FROM {$param->table_name} WHERE facebook_id='{$param->fbid}' and fb_dataid='{$data->id}'";
            $result = mysql_query($sql_select);
            if (mysql_num_rows($result) == 0) {
                $data_temp = serialize($data);
                $dt = new DateTime($data->updated_time);
                $fbdata_postedtime = $dt->format('Y-n-j H:i:s');
                $sql .= sprintf(", ('%s','%s','%s','%s','%s','%s')", mysql_real_escape_string($param->fbid), $param->connection, $data->id, mysql_real_escape_string($data_temp), $fbdata_postedtime, $cdate);
            }
        }
        if ($sql) {
            $sql = substr($sql, 1);
            $query = $sql_insert . $sql;
            mysql_query($query);
            if (mysql_errno()) {
                logme(mysql_error() . '==' . $query);
                die(mysql_errno() . ': ' . mysql_error() . '; ' . $query . "\n");
            }
        }
        $fbdata = '';
        if ($counter >= $param->limit) {
            //navigate to next page of the graph explorer
            $offset += 25;
            $graph_url = $param->graph_url . $param->connection . '?access_token=' . $param->token . "&since={$since_dt->since}&limit={$param->limit}&offset={$offset}";
            $fb = get_graphapi_data($graph_url);
            $fbdata = $fb->data;
        }
    }
    mysql_free_result($result);
    save_comments_likes($param);
}
Example #2
0
 function init($tasks = array())
 {
     global $graph_start_date;
     global $graph_completion_date;
     global $graph_type;
     if (count($tasks) == 0) {
         image_die("No Tasks Found for " . $this->title);
     }
     // Set the enviroment variable for GD
     putenv('GDFONTPATH=' . realpath('../util'));
     $this->height = count($tasks) * ($this->bar_height + $this->task_padding) * 2 + $this->top_margin + $this->bottom_margin;
     get_date_range($tasks);
     // create image
     $this->image = imageCreate($this->width, $this->height);
     // 'Constant' colours for task types
     $this->task_colors = array('Task' => array("actual" => imageColorAllocate($this->image, 133, 164, 241), "target" => imageColorAllocate($this->image, 190, 219, 255)), 'Parent' => array("actual" => imageColorAllocate($this->image, 153, 153, 153), "target" => imageColorAllocate($this->image, 204, 204, 204)));
     // allocate all required colors
     $this->color_background = imageColorAllocate($this->image, 255, 255, 255);
     $this->color_text = imageColorAllocate($this->image, 0, 0, 0);
     $this->color_grid = imageColorAllocate($this->image, 161, 202, 255);
     $this->color_milestone = imageColorAllocate($this->image, 255, 128, 255);
     $this->color_today = imageColorAllocate($this->image, 255, 192, 0);
     // clear the image space with the background color
     imageFilledRectangle($this->image, 0, 0, $this->width - 1, $this->height - 1, $this->color_background);
     imageRectangle($this->image, 0, 0, $this->width - 1, $this->height - 1, $this->color_grid);
     imagettftext($this->image, ALLOC_FONT_SIZE + 3, 0, 6, 28, $this->color_text, ALLOC_FONT, $this->title);
     $this->y = $this->top_margin;
 }
function get_photo($param, $updater_file)
{
    logme('get photos', $updater_file);
    try {
        $since_dt = get_date_range($param);
        $offset = $param->offset;
        $graph_url = $param->graph_url . $param->connection . '?access_token=' . $param->token . "&since={$since_dt->since}&limit={$param->limit}&offset={$offset}";
        logme("graph url: {$graph_url}", $updater_file);
        $fb = get_graphapi_data($graph_url);
        $fbdata = $fb->data;
        $cdate = date('Y-n-j H:i:s');
        if ($fbdata) {
            echo "starting updating photos...\n";
            logme('start updating photos....', $updater_file);
            logme('fbdata=>' . count($fbdata), $updater_file);
        }
        $sql_insert = "INSERT INTO {$param->table_name}(facebook_id,connection,fb_dataid,fbdata,width,height,hd,medium,small,fbdata_postedtime,created_date) VALUES ";
        while ($fbdata) {
            $sql = '';
            $counter = 0;
            foreach ($fbdata as $data) {
                $counter++;
                //logme("\ncounter: " . $counter++, $updater_file);
                logme("data id:" . $data->id, $updater_file);
                //check for duplicate, just in case
                $sql_select = "SELECT facebook_id FROM {$param->table_name} WHERE facebook_id='{$param->fbid}' and fb_dataid='{$data->id}'";
                $result = mysql_query($sql_select);
                if (mysql_errno()) {
                    logme(mysql_error() . '==' . $query, $updater_file);
                    die(mysql_errno() . ': ' . mysql_error() . '; ' . $query . "\n");
                    echo mysql_error() . '==' . $query;
                    logme(mysql_error() . '==' . $query, $updater_file);
                }
                if (mysql_num_rows($result) == 0) {
                    $data->original_image = $data->source;
                    $data_temp = serialize($data);
                    list($d, $t) = explode("+", $date->updated_time);
                    $fbdata_postedtime = str_replace("T", " ", $d);
                    $hd = $data->images[0]->source;
                    $medium = $data->images[3]->source;
                    $small = $data->images[7]->source;
                    $sql .= sprintf(", ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", mysql_real_escape_string($param->fbid), mysql_real_escape_string($param->connection), mysql_real_escape_string($data->id), mysql_real_escape_string($data_temp), $data->width, $data->height, $hd, $medium, $small, $fbdata_postedtime, $cdate);
                    logme("image save: {$medium}", $updater_file);
                }
                mysql_free_result($result);
            }
            if ($sql) {
                $sql = substr($sql, 1);
                $query = $sql_insert . $sql;
                mysql_query($query);
                if (mysql_errno()) {
                    logme(mysql_error() . '==' . $query, $updater_file);
                    die(mysql_errno() . ': ' . mysql_error() . '; ' . $query . "\n");
                    echo mysql_errno() . ': ' . mysql_error() . '; ' . $query . "\n";
                }
            }
            $fbdata = '';
            if ($counter >= $param->limit) {
                //navigate to next page of the graph explorer
                $offset += 25;
                $graph_url = $param->graph_url . $param->connection . '?access_token=' . $param->token . "&since={$since_dt->since}&limit={$param->limit}&offset={$offset}";
                $fb = get_graphapi_data($graph_url);
                $fbdata = $fb->data;
                logme("\nprocessing next batch...", $updater_file);
            }
        }
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage(), "\n";
        logme('Caught exception: ', $e->getMessage(), "\n", $updater_file);
    }
    //commented as it is not use for now
    //save_comments_likes($param);
}
Example #4
0
 if ($action == 'delete_line') {
     $ret = $form->form_confirm($_SERVER["PHP_SELF"] . "?id=" . $id . "&rowid=" . GETPOST('rowid'), $langs->trans("DeleteLine"), $langs->trans("ConfirmDeleteLine"), "confirm_delete_line", '', 'yes', 1);
     if ($ret == 'html') {
         print '<br>';
     }
 }
 print '<table class="border centpercent">';
 $linkback = '<a href="' . DOL_URL_ROOT . '/expensereport/list.php' . (!empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
 // Ref
 print '<tr><td width="25%">' . $langs->trans("Ref") . '</td><td colspan="2">';
 print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
 print '</td></tr>';
 print '<tr>';
 print '<td>' . $langs->trans("Period") . '</td>';
 print '<td colspan="2">';
 print get_date_range($object->date_debut, $object->date_fin, '', $langs, 0);
 print '</td>';
 print '</tr>';
 if (!empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) {
     print '<tr>';
     print '<td>' . $langs->trans("ModePaiement") . '</td>';
     print '<td colspan="2">' . $object->libelle_paiement . '</td>';
     print '</tr>';
 }
 // Status
 print '<tr>';
 print '<td>' . $langs->trans("Statut") . '</td>';
 print '<td colspan="2">' . $object->getLibStatut(4) . '</td>';
 print '</tr>';
 print '<tr>';
 print '<td>' . $langs->trans("NotePublic") . '</td>';
Example #5
0
        if ($type == 1) {
            $text = img_object($langs->trans('Service'), 'service');
        } else {
            $text = img_object($langs->trans('Product'), 'product');
        }
        if (!empty($line->label)) {
            $text .= ' <strong>' . $line->label . '</strong>';
            echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, !empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '');
        } else {
            if (!empty($line->fk_parent_line)) {
                echo img_picto('', 'rightarrow');
            }
            echo $text . ' ' . dol_htmlentitiesbr($line->description);
        }
        // Show range
        echo get_date_range($line->date_start, $line->date_end, $format);
    }
}
?>
	</td>
	<?php 
if ($object->element == 'supplier_proposal') {
    ?>
		<td class="linecolrefsupplier" align="right"><?php 
    echo $line->ref_fourn;
    ?>
</td>
	<?php 
}
?>
	<td align="right" class="linecolvat nowrap"><?php 
Example #6
0
function get_photo($param)
{
    $since_dt = get_date_range($param);
    $offset = $param->offset;
    $graph_url = $param->graph_url . $param->connection . '?access_token=' . $param->token . "&since={$since_dt->since}&limit={$param->limit}&offset={$offset}";
    $fb = @json_decode(file_get_contents($graph_url));
    $fbdata = $fb->data;
    $cdate = date('Y-n-j H:i:s');
    if ($fbdata) {
        logme('updating photos');
    }
    $sql_insert = "INSERT INTO {$param->table_name}(facebook_id,connection,fb_dataid,fbdata,width,height,hd,medium,small,fbdata_postedtime,created_date) VALUES ";
    while ($fbdata) {
        $sql = '';
        $counter = 0;
        foreach ($fbdata as $data) {
            $counter++;
            //check for duplicate, just in case
            $sql_select = "SELECT facebook_id FROM {$param->table_name} WHERE facebook_id='{$param->fbid}' and fb_dataid='{$data->id}'";
            $result = mysql_query($sql_select);
            if (mysql_errno()) {
                logme(mysql_error() . '==' . $query);
                die(mysql_errno() . ': ' . mysql_error() . '; ' . $query . "\n");
            }
            if (mysql_num_rows($result) == 0) {
                $data->original_image = $data->source;
                $data_temp = serialize($data);
                $dt = new DateTime($data->updated_time);
                $fbdata_postedtime = $dt->format('Y-n-j H:i:s');
                $hd = $data->images[0]->source;
                $medium = $data->images[3]->source;
                $small = $data->images[7]->source;
                $sql .= sprintf(", ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", mysql_real_escape_string($param->fbid), mysql_real_escape_string($param->connection), mysql_real_escape_string($data->id), mysql_real_escape_string($data_temp), $data->width, $data->height, $hd, $medium, $small, $fbdata_postedtime, $cdate);
            }
            mysql_free_result($result);
        }
        if ($sql) {
            $sql = substr($sql, 1);
            $query = $sql_insert . $sql;
            mysql_query($query);
            if (mysql_errno()) {
                logme(mysql_error() . '==' . $query);
                die(mysql_errno() . ': ' . mysql_error() . '; ' . $query . "\n");
            }
        }
        $fbdata = '';
        if ($counter >= $param->limit) {
            //navigate to next page of the graph explorer
            $offset += 25;
            $graph_url = $param->graph_url . $param->connection . '?access_token=' . $param->token . "&since={$since_dt->since}&limit={$param->limit}&offset={$offset}";
            $fb = @json_decode(file_get_contents($graph_url));
            $fbdata = $fb->data;
        }
    }
    save_comments_likes($param);
}
Example #7
0
 /**
  * 	Return HTML with a line of table array of source object lines
  *  TODO Move this and previous function into output html class file (htmlline.class.php).
  *  If lines are into a template, title must also be into a template
  *  But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
  *
  * 	@param	array	$line		Line
  * 	@param	string	$var		Var
  * 	@return	void
  */
 function printOriginLine($line, $var)
 {
     global $conf, $langs, $bc;
     //var_dump($line);
     $date_start = $line->date_debut_prevue;
     if ($line->date_debut_reel) {
         $date_start = $line->date_debut_reel;
     }
     $date_end = $line->date_fin_prevue;
     if ($line->date_fin_reel) {
         $date_end = $line->date_fin_reel;
     }
     $this->tpl['label'] = '';
     if (!empty($line->fk_parent_line)) {
         $this->tpl['label'] .= img_picto('', 'rightarrow');
     }
     if (($line->info_bits & 2) == 2) {
         $discount = new DiscountAbsolute($this->db);
         $discount->fk_soc = $this->socid;
         $this->tpl['label'] .= $discount->getNomUrl(0, 'discount');
     } else {
         if ($line->fk_product) {
             $productstatic = new Product($this->db);
             $productstatic->id = $line->fk_product;
             $productstatic->ref = $line->ref;
             $productstatic->type = $line->fk_product_type;
             $this->tpl['label'] .= $productstatic->getNomUrl(1);
             $this->tpl['label'] .= $line->label ? ' - ' . $line->label : '';
             // Dates
             if ($line->product_type == 1 && ($date_start || $date_end)) {
                 $this->tpl['label'] .= get_date_range($date_start, $date_end);
             }
         } else {
             $this->tpl['label'] .= $line->product_type == -1 ? '&nbsp;' : ($line->product_type == 1 ? img_object($langs->trans(''), 'service') : img_object($langs->trans(''), 'product'));
             $this->tpl['label'] .= $line->label ? '&nbsp;' . $line->label : '';
             // Dates
             if ($line->product_type == 1 && ($date_start || $date_end)) {
                 $this->tpl['label'] .= get_date_range($date_start, $date_end);
             }
         }
     }
     if ($line->desc) {
         if ($line->desc == '(CREDIT_NOTE)') {
             $discount = new DiscountAbsolute($this->db);
             $discount->fetch($line->fk_remise_except);
             $this->tpl['description'] = $langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0));
         } elseif ($line->desc == '(DEPOSIT)') {
             $discount = new DiscountAbsolute($this->db);
             $discount->fetch($line->fk_remise_except);
             $this->tpl['description'] = $langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0));
         } else {
             $this->tpl['description'] = dol_trunc($line->desc, 60);
         }
     } else {
         $this->tpl['description'] = '&nbsp;';
     }
     $this->tpl['vat_rate'] = vatrate($line->tva_tx, true);
     $this->tpl['price'] = price($line->subprice);
     $this->tpl['qty'] = ($line->info_bits & 2) != 2 ? $line->qty : '&nbsp;';
     $this->tpl['remise_percent'] = ($line->info_bits & 2) != 2 ? vatrate($line->remise_percent, true) : '&nbsp;';
     // Output template part (modules that overwrite templates must declare this into descriptor)
     // Use global variables + $dateSelector + $seller and $buyer
     $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
     foreach ($dirtpls as $reldir) {
         $res = @(include dol_buildpath($reldir . '/originproductline.tpl.php'));
         if ($res) {
             break;
         }
     }
 }
Example #8
0
 $expensereport->fetch($chid);
 $total = $expensereport->total_ttc;
 print load_fiche_titre($langs->trans("DoPayment"));
 if ($mesg) {
     print "<div class=\"error\">{$mesg}</div>";
 }
 print '<form name="add_payment" action="' . $_SERVER['PHP_SELF'] . '" method="post">';
 print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
 print '<input type="hidden" name="id" value="' . $chid . '">';
 print '<input type="hidden" name="chid" value="' . $chid . '">';
 print '<input type="hidden" name="action" value="add_payment">';
 dol_fiche_head();
 print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
 print '<tr class="liste_titre"><td colspan="3">' . $langs->trans("ExpenseReport") . '</td>';
 print '<tr><td>' . $langs->trans("Ref") . '</td><td colspan="2"><a href="' . DOL_URL_ROOT . '/expensereport/card.php?id=' . $chid . '">' . $expensereport->ref . '</a></td></tr>';
 print '<tr><td>' . $langs->trans("Period") . '</td><td colspan="2">' . get_date_range($expensereport->date_debut, $expensereport->date_fin, "", $langs, 0) . '</td></tr>';
 print '<tr><td>' . $langs->trans("Amount") . '</td><td colspan="2">' . price($expensereport->total_ttc, 0, $outputlangs, 1, -1, -1, $conf->currency) . '</td></tr>';
 $sql = "SELECT sum(p.amount) as total";
 $sql .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as p";
 $sql .= " WHERE p.fk_expensereport = " . $chid;
 $resql = $db->query($sql);
 if ($resql) {
     $obj = $db->fetch_object($resql);
     $sumpaid = $obj->total;
     $db->free();
 }
 print '<tr><td>' . $langs->trans("AlreadyPaid") . '</td><td colspan="2">' . price($sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency) . '</td></tr>';
 print '<tr><td valign="top">' . $langs->trans("RemainderToPay") . '</td><td colspan="2">' . price($total - $sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency) . '</td></tr>';
 print '<tr class="liste_titre">';
 print "<td colspan=\"3\">" . $langs->trans("Payment") . '</td>';
 print '</tr>';
Example #9
0
            $subscriptionstatic->id = $obj->cid;
            $subscriptionstatic->ref = $obj->cid;
            $staticmember->id = $obj->rowid;
            $staticmember->lastname = $obj->lastname;
            $staticmember->firstname = $obj->firstname;
            if (!empty($obj->fk_soc)) {
                $staticmember->socid = $obj->fk_soc;
                $staticmember->fetch_thirdparty();
                $staticmember->name = $staticmember->thirdparty->name;
            } else {
                $staticmember->name = $obj->company;
            }
            $staticmember->ref = $staticmember->getFullName($langs);
            print '<td>' . $subscriptionstatic->getNomUrl(1) . '</td>';
            print '<td>' . $staticmember->getNomUrl(1, 32, 'subscription') . '</td>';
            print '<td>' . get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)) . '</td>';
            print '<td align="right">' . price($obj->cotisation) . '</td>';
            //print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
            print '<td align="right">' . dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour') . '</td>';
            print '</tr>';
            $i++;
        }
    }
    print "</table><br>";
} else {
    dol_print_error($db);
}
// Summary of members by type
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("MembersTypes") . '</td>';
Example #10
0
/**
 *    Format output for start and end date
 *    @param      	date_start    Start date
 *    @param      	date_end      End date
 *    @param      	format        Output format
 *    @param		outputlangs   Output language
 */
function print_date_range($date_start, $date_end, $format = '', $outputlangs = '')
{
    print get_date_range($date_start, $date_end, $format, $outputlangs);
}
Example #11
0
 public function cpm_page()
 {
     $this->load->model(array("Kanal_Model", "Productgroup_Model", "Position_Model"));
     $kanal_id = $this->input->post("kanal_id");
     $product_group_id = $this->input->post("product_group_id");
     $position_id = $this->input->post("position_id");
     $start_date = $this->input->post("start_date");
     $end_date = $this->input->post("end_date");
     $arrCpm = array();
     $dataCpmQuota = $this->Order_Model->getCpmQuota($kanal_id, $product_group_id, $position_id);
     $cpmQuota = $dataCpmQuota->cpm_quota;
     $detailKanal = $this->Kanal_Model->get($kanal_id);
     $detailProductgroup = $this->Productgroup_Model->get($product_group_id);
     $detailPosition = $this->Position_Model->get($position_id);
     $kanal = $detailKanal->name;
     $productGroup = $detailProductgroup->name;
     $position = $detailPosition->name;
     $allCpmUsed = $this->Order_Model->getUsedCpmQuota($kanal_id, $product_group_id, $position_id, $start_date, $end_date);
     foreach ($allCpmUsed as $cpmUsed) {
         $cpm_start_date = $cpmUsed->start_date;
         $cpm_end_date = $cpmUsed->end_date;
         $cpm_quota = $cpmUsed->cpm_quota;
         $arrDateRange = get_date_range($cpm_start_date, $cpm_end_date);
         foreach ($arrDateRange as $rangeDate) {
             $day = $rangeDate;
             $expDate = explode("-", $day);
             $year = $expDate[0];
             $month = $expDate[1];
             $date = $expDate[2];
             if (isset($arrCpm[$year][$month][$date])) {
                 $arrCpm[$year][$month][$date] += $cpm_quota;
             } else {
                 $arrCpm[$year][$month][$date] = $cpm_quota;
             }
         }
     }
     $arrDate = get_date_range($start_date, $end_date);
     $data["all_cpm"] = $arrCpm;
     $data["all_date"] = $arrDate;
     $data["cpm_quota"] = $cpmQuota;
     $data["kanal"] = $kanal;
     $data["product_group"] = $productGroup;
     $data["position"] = $position;
     $data["read"] = $this->_access["read"];
     $this->load->view("order/cpm", $data);
 }
         }
     } else {
         //if (! empty($objp->fk_parent_line)) echo img_picto('', 'rightarrow');
         if ($type == 1) {
             $text = img_object($langs->trans('Service'), 'service');
         } else {
             $text = img_object($langs->trans('Product'), 'product');
         }
         if (!empty($objp->label)) {
             $text .= ' <strong>' . $objp->label . '</strong>';
             echo $form->textwithtooltip($text, dol_htmlentitiesbr($objp->description), 3, '', '', $i, 0, '');
         } else {
             echo $text . ' ' . dol_htmlentitiesbr($objp->description);
         }
         // Show range
         echo get_date_range($objp->date_start, $objp->date_end);
     }
 }
 /*
 $prodreftxt='';
 if ($objp->prod_id > 0)
 {
 	$productstatic->id = $objp->prod_id;
 	$productstatic->ref = $objp->prod_ref;
 	$productstatic->status = $objp->prod_type;
 	$prodreftxt = $productstatic->getNomUrl(0);
 	if(!empty($objp->product_label)) $prodreftxt .= ' - '.$objp->product_label;
 }
 // Show range
 $prodreftxt .= get_date_range($objp->date_start, $objp->date_end);
 // Add description in form
Example #13
0
 /**
  * 	Return HTML with a line of table array of source object lines
  *  TODO Move this and previous function into output html class file (htmlline.class.php).
  *  If lines are into a template, title must also be into a template
  *  But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
  * 	@param		line
  * 	@param		var
  */
 function printOriginLine($line, $var)
 {
     global $langs, $bc;
     //var_dump($line);
     $date_start = $line->date_debut_prevue;
     if ($line->date_debut_reel) {
         $date_start = $line->date_debut_reel;
     }
     $date_end = $line->date_fin_prevue;
     if ($line->date_fin_reel) {
         $date_end = $line->date_fin_reel;
     }
     $this->tpl['label'] = '';
     if (!empty($line->fk_parent_line)) {
         $this->tpl['label'] .= img_picto('', 'rightarrow');
     }
     if (($line->info_bits & 2) == 2) {
         $discount = new DiscountAbsolute($db);
         $discount->fk_soc = $this->socid;
         $this->tpl['label'] .= $discount->getNomUrl(0, 'discount');
     } else {
         if ($line->fk_product) {
             $productstatic = new Product($this->db);
             $productstatic->id = $line->fk_product;
             $productstatic->ref = $line->ref;
             $productstatic->type = $line->fk_product_type;
             $this->tpl['label'] .= $productstatic->getNomUrl(1);
             $this->tpl['label'] .= $line->label ? ' - ' . $line->label : '';
             // Dates
             if ($line->product_type == 1 && ($date_start || $date_end)) {
                 $this->tpl['label'] .= get_date_range($date_start, $date_end);
             }
         } else {
             $this->tpl['label'] .= $line->product_type == -1 ? '&nbsp;' : ($line->product_type == 1 ? img_object($langs->trans(''), 'service') : img_object($langs->trans(''), 'product'));
             $this->tpl['label'] .= $line->label ? '&nbsp;' . $line->label : '';
             // Dates
             if ($line->product_type == 1 && ($date_start || $date_end)) {
                 $this->tpl['label'] .= get_date_range($date_start, $date_end);
             }
         }
     }
     if ($line->desc) {
         if ($line->desc == '(CREDIT_NOTE)') {
             $discount = new DiscountAbsolute($this->db);
             $discount->fetch($line->fk_remise_except);
             $this->tpl['description'] = $langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0));
         } elseif ($line->desc == '(DEPOSIT)') {
             $discount = new DiscountAbsolute($this->db);
             $discount->fetch($line->fk_remise_except);
             $this->tpl['description'] = $langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0));
         } else {
             $this->tpl['description'] = dol_trunc($line->desc, 60);
         }
     } else {
         $this->tpl['description'] = '&nbsp;';
     }
     $this->tpl['vat_rate'] = vatrate($line->tva_tx, true);
     $this->tpl['price'] = price($line->subprice);
     $this->tpl['qty'] = ($line->info_bits & 2) != 2 ? $line->qty : '&nbsp;';
     $this->tpl['remise_percent'] = ($line->info_bits & 2) != 2 ? vatrate($line->remise_percent, true) : '&nbsp;';
     include DOL_DOCUMENT_ROOT . '/core/tpl/originproductline.tpl.php';
 }
Example #14
0
 /**
  *	Return clicable name (with picto eventually)
  *
  *	@param	int		$withpicto		0=No picto, 1=Include picto into link, 2=Only picto
  *	@param	string	$option			'withproject' or ''
  *  @param	string	$mode			Mode 'task', 'time', 'contact', 'note', document' define page to link to.
  * 	@param	int		$addlabel		0=Default, 1=Add label into string, >1=Add first chars into string
  *  @param	string	$sep			Separator between ref and label if option addlabel is set
  *	@return	string					Chaine avec URL
  */
 function getNomUrl($withpicto = 0, $option = '', $mode = 'task', $addlabel = 0, $sep = ' - ')
 {
     global $langs;
     $result = '';
     $label = '<u>' . $langs->trans("ShowTask") . '</u>';
     if (!empty($this->ref)) {
         $label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
     }
     if (!empty($this->label)) {
         $label .= '<br><b>' . $langs->trans('LabelTask') . ':</b> ' . $this->label;
     }
     if ($this->date_start || $this->date_end) {
         $label .= "<br>" . get_date_range($this->date_start, $this->date_end, '', $langs, 0);
     }
     $linkclose = '" title="' . dol_escape_htmltag($label, 1) . '" class="classfortooltip">';
     $link = '<a href="' . DOL_URL_ROOT . '/projet/tasks/' . $mode . '.php?id=' . $this->id . ($option == 'withproject' ? '&withproject=1' : '') . $linkclose;
     $linkend = '</a>';
     $picto = 'projecttask';
     if ($withpicto) {
         $result .= $link . img_object($label, $picto, 'class="classfortooltip"') . $linkend;
     }
     if ($withpicto && $withpicto != 2) {
         $result .= ' ';
     }
     if ($withpicto != 2) {
         $result .= $link . $this->ref . $linkend . ($addlabel && $this->label ? $sep . dol_trunc($this->label, $addlabel > 1 ? $addlabel : 0) : '');
     }
     return $result;
 }
        if ($type == 1) {
            $text = img_object($langs->trans('Service'), 'service');
        } else {
            $text = img_object($langs->trans('Product'), 'product');
        }
        if (!empty($line->label)) {
            $text .= ' <strong>' . $line->label . '</strong>';
            echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, !empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '');
        } else {
            if (!empty($line->fk_parent_line)) {
                echo img_picto('', 'rightarrow');
            }
            echo $text . ' ' . dol_htmlentitiesbr($line->description);
        }
        // Show range
        echo get_date_range($line->date_start, $line->date_end);
    }
}
?>
	</td>

	<td align="center" class="nowrap"><input type="checkbox" class="check" rel=<?php 
echo '"' . $line->ref . '"';
?>
></td>

	<td align="right" class="nowrap"><?php 
$coldisplay++;
echo vatrate($line->tva_tx, '%', $line->info_bits);
?>
</td>
Example #16
0
function _xTradesGraphDataHistoryProd()
{
    require_once 'stats.php';
    list($date_start, $date_end) = get_date_range($_REQUEST);
    $history = new StatsHistory($_REQUEST['domain'], $date_start, $date_end, $_REQUEST['breakdown']);
    include 'trades-graph-data-historical-prod.php';
}
Example #17
0
/**
 * initialize Gui
 */
function initializeGui(&$dbHandler, &$argsObj)
{
    $reports_cfg = config_get('reportsCfg');
    $gui = new stdClass();
    $tplan_mgr = new testplan($dbHandler);
    $tproject_mgr = new testproject($dbHandler);
    $getOpt = array('outputFormat' => 'map');
    $gui->platformSet = $tplan_mgr->getPlatforms($argsObj->tplan_id, $getOpt);
    $gui->title = lang_get('query_metrics_report');
    $gui->showPlatforms = true;
    if (is_null($gui->platformSet)) {
        $gui->platformSet = array('');
        $gui->showPlatforms = false;
    }
    $gui->resultsCfg = config_get('results');
    $date_range = get_date_range($_REQUEST);
    $gui->startTime = $date_range->start->time;
    $gui->endTime = $date_range->end->time;
    $gui_open = config_get('gui_separator_open');
    $gui_close = config_get('gui_separator_close');
    $gui->str_option_any = $gui_open . lang_get('any') . $gui_close;
    $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close;
    $gui->search_notes_string = $argsObj->search_notes_string;
    $gui->tplan_id = $argsObj->tplan_id;
    $gui->tproject_id = $argsObj->tproject_id;
    $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
    $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id);
    $gui->tplan_name = $tplan_info['name'];
    $gui->tproject_name = $tproject_info['name'];
    $testsuiteIds = null;
    $testsuiteNames = null;
    $tsuites_qty = sizeOf($argsObj->testsuitesSelected);
    for ($id = 0; $id < $tsuites_qty; $id++) {
        list($suiteId, $suiteName) = preg_split("/\\,/", $argsObj->testsuitesSelected[$id], 2);
        $testsuiteIds[$id] = $suiteId;
        $testsuiteNames[$id] = $suiteName;
    }
    $buildsToQuery = -1;
    if (sizeof($argsObj->buildsSelected)) {
        $buildsToQuery = implode(",", $argsObj->buildsSelected);
    }
    // statusForClass is used for results.class.php
    // lastStatus is used to be displayed
    $statusForClass = 'a';
    // amitkhullar - added this parameter to get the latest results.
    $latest_resultset = $argsObj->display->latest_results;
    // BUGID 2500
    // $assignee = $argsObj->ownerSelected ? TL_USER_ANYBODY : null;
    // $tester = $argsObj->executorSelected ? TL_USER_ANYBODY : null;
    $assignee = $argsObj->ownerSelected > 0 ? $argsObj->ownerSelected : TL_USER_ANYBODY;
    $tester = $argsObj->executorSelected > 0 ? $argsObj->executorSelected : TL_USER_ANYBODY;
    $re = new newResults($dbHandler, $tplan_mgr, $tproject_info, $tplan_info, $testsuiteIds, $buildsToQuery, $statusForClass, $latest_resultset, $argsObj->keywordSelected, $assignee, $date_range->start->time, $date_range->end->time, $tester, $argsObj->search_notes_string, null);
    $gui->suiteList = $re->getSuiteList();
    // test executions results
    $gui->flatArray = $re->getFlatArray();
    $gui->mapOfSuiteSummary = $re->getAggregateMap();
    $gui->totals = new stdClass();
    $gui->totals->items = $re->getTotalsForPlan();
    $gui->totals->labels = array();
    foreach ($gui->totals->items as $key => $value) {
        $l18n = $key == 'total' ? 'th_total_cases' : $gui->resultsCfg['status_label'][$key];
        $gui->totals->labels[$key] = lang_get($l18n);
    }
    // BUGID 2012 - franciscom
    $gui->keywords = new stdClass();
    $gui->keywords->items[0] = $gui->str_option_any;
    if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) {
        $gui->keywords->items += $tplan_keywords_map;
    }
    $gui->keywords->qty = count($gui->keywords->items);
    $gui->keywordSelected = $gui->keywords->items[$argsObj->keywordSelected];
    $gui->builds_html = $tplan_mgr->get_builds_for_html_options($gui->tplan_id);
    $gui->users = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any));
    $gui->ownerSelected = $gui->users[$argsObj->ownerSelected];
    $gui->executorSelected = $gui->users[$argsObj->executorSelected];
    $gui->testsuitesSelected = $testsuiteNames;
    $gui->buildsSelected = $argsObj->buildsSelected;
    $gui->display = $argsObj->display;
    // init display rows attribute and some status localized labels
    $gui->displayResults = array();
    $gui->lastStatus = array();
    foreach ($reports_cfg->exec_status as $verbose => $label) {
        $gui->displayResults[$gui->resultsCfg['status_code'][$verbose]] = false;
    }
    foreach ($gui->resultsCfg['status_label'] as $status_verbose => $label_key) {
        $gui->statusLabels[$gui->resultsCfg['status_code'][$status_verbose]] = lang_get($label_key);
    }
    $lastStatus_localized = null;
    foreach ($argsObj->lastStatus as $key => $status_code) {
        $verbose = $gui->resultsCfg['code_status'][$status_code];
        $gui->displayResults[$status_code] = true;
        $lastStatus_localized[] = lang_get($gui->resultsCfg['status_label'][$verbose]);
    }
    $gui->lastStatus = $lastStatus_localized;
    return $gui;
}