/**
  *  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;
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
     $propalstatic = new Propal($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLastPropals", $max));
     if ($user->rights->propale->lire) {
         $sql = "SELECT s.nom, s.rowid as socid,";
         $sql .= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
         $sql .= ", " . MAIN_DB_PREFIX . "propal as p";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE p.fk_soc = s.rowid";
         $sql .= " AND p.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 p.datep DESC, p.ref DESC ";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $now = dol_now();
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $datec = $db->jdate($objp->datec);
                 $dateterm = $db->jdate($objp->fin_validite);
                 $dateclose = $db->jdate($objp->date_cloture);
                 $late = '';
                 if ($objp->fk_statut == 1 && $dateterm < $now - $conf->propal->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 . "/comm/propal.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref, 'text2' => $late, 'url' => DOL_URL_ROOT . "/comm/propal.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" width="18"', 'text' => $propalstatic->LibStatut($objp->fk_statut, 3));
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedProposals"));
             }
             $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 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;
     $now = dol_now();
     $this->info_box_head = array('text' => $langs->trans("BoxLastExpiredServices", $max));
     if ($user->rights->contrat->lire) {
         // Select contracts with at least one expired service
         $sql = "SELECT ";
         $sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,";
         $sql .= " s.nom as name, s.rowid as socid,";
         $sql .= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services";
         $sql .= " FROM " . MAIN_DB_PREFIX . "contrat as c, " . MAIN_DB_PREFIX . "societe s, " . MAIN_DB_PREFIX . "contratdet as cd";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '" . $db->idate($now) . "'";
         $sql .= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
         if ($user->societe_id) {
             $sql .= ' AND c.fk_soc = ' . $user->societe_id;
         }
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, s.nom, s.rowid";
         $sql .= " ORDER BY date_line ASC";
         $sql .= $db->plimit($max, 0);
         $resql = $db->query($sql);
         if ($resql) {
             $num = $db->num_rows($resql);
             $i = 0;
             while ($i < $num) {
                 $late = '';
                 $objp = $db->fetch_object($resql);
                 $dateline = $db->jdate($objp->date_line);
                 if ($dateline + $conf->contrat->services->expires->warning_delay < $now) {
                     $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/card.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref ? $objp->ref : $objp->rowid, 'url' => DOL_URL_ROOT . "/contrat/card.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($objp->name, 40), 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][4] = array('td' => 'align="center"', 'text' => dol_print_date($dateline, 'day'), 'text2' => $late);
                 $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => $objp->nb_services);
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoExpiredServices"));
             }
             $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"));
     }
 }
Beispiel #3
0
 $nbofloop = min($num, empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
 while ($i < $nbofloop) {
     $obj = $db->fetch_object($result);
     $var = !$var;
     print '<tr ' . $bc[$var] . '>';
     // Ref
     print '<td class="nowrap" width="140">';
     $supplier_proposalstatic->id = $obj->supplier_proposalid;
     $supplier_proposalstatic->ref = $obj->ref;
     print '<table class="nobordernopadding"><tr class="nocellnopadd">';
     print '<td class="nobordernopadding nowrap">';
     print $supplier_proposalstatic->getNomUrl(1);
     print '</td>';
     print '<td width="18" class="nobordernopadding nowrap">';
     if ($db->jdate($obj->dfv) < $now - $conf->supplier_proposal->cloture->warning_delay) {
         print img_warning($langs->trans("Late"));
     }
     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">';
Beispiel #4
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">';
				print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am);
Beispiel #5
0
     $nameRemain = 'remain_' . $objp->facid;
     if ($action != 'add_paiement') {
         if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT)) {
             print img_picto($langs->trans('AddRemind'), 'rightarrow.png', 'id="' . $objp->facid . '" "');
         }
         print '<input type=hidden name="' . $nameRemain . '" value="' . $remaintopay . '">';
         print '<input type="text" size="8" name="' . $namef . '" value="' . $_POST[$namef] . '">';
     } else {
         print '<input type="text" size="8" name="' . $namef . '_disabled" value="' . $_POST[$namef] . '" disabled="true">';
         print '<input type="hidden" name="' . $namef . '" value="' . $_POST[$namef] . '">';
     }
     print "</td>";
     // Warning
     print '<td align="center" width="16">';
     if ($amounts[$invoice->id] && $amounts[$invoice->id] > $amountsresttopay[$invoice->id]) {
         print ' ' . img_warning($langs->trans("PaymentHigherThanReminderToPay"));
     }
     print '</td>';
     print "</tr>\n";
     $total += $objp->total;
     $total_ttc += $objp->total_ttc;
     $totalrecu += $paiement;
     $totalrecucreditnote += $creditnotes;
     $totalrecudeposits += $deposits;
     $i++;
 }
 if ($i > 1) {
     // Print total
     print '<tr class="liste_total">';
     print '<td colspan="2" align="left">' . $langs->trans('TotalTTC') . '</td>';
     print '<td align="right"><b>' . price($total_ttc) . '</b></td>';
Beispiel #6
0
 print '<tr><td>';
 print '<table class="nobordernopadding" width="100%"><tr><td>';
 print $langs->trans('DateMaxPayment');
 print '</td>';
 if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) {
     print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editpaymentterm&amp;facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
 }
 print '</tr></table>';
 print '</td><td colspan="3">';
 if ($object->type != Facture::TYPE_CREDIT_NOTE) {
     if ($action == 'editpaymentterm') {
         $form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_lim_reglement, 'paymentterm');
     } else {
         print dol_print_date($object->date_lim_reglement, 'daytext');
         if ($object->hasDelay()) {
             print img_warning($langs->trans('Late'));
         }
     }
 } else {
     print '&nbsp;';
 }
 print '</td></tr>';
 // Payment mode
 print '<tr><td>';
 print '<table class="nobordernopadding" width="100%"><tr><td>';
 print $langs->trans('PaymentMode');
 print '</td>';
 if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) {
     print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&amp;facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
 }
 print '</tr></table>';
Beispiel #7
0
	/**
	 *      \brief      Charge les donnees en memoire pour affichage ulterieur
	 *      \param      $max        Nombre maximum d'enregistrements a charger
	 */
	function loadBox($max=5)
	{
		global $conf, $user, $langs, $db;

		$this->max=$max;

		include_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
		$facturestatic=new Facture($db);

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

		if ($user->rights->facture->lire)
		{
			$sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.datef as df";
			$sql.= ", f.paye, f.fk_statut, f.datec, f.tms";
			$sql.= ", s.nom, s.rowid as socid";
			$sql.= ", f.date_lim_reglement as datelimite";
			$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
			if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
			$sql.= ")";
			$sql.= " WHERE f.fk_soc = s.rowid";
			$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 f.tms DESC";
			$sql.= $db->plimit($max, 0);

			$result = $db->query($sql);
			if ($result)
			{
				$num = $db->num_rows($result);
				$now=gmmktime();

				$i = 0;
				$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';

				while ($i < $num)
				{
					$objp = $db->fetch_object($result);
					$datelimite=$db->jdate($objp->datelimite);
					$datec=$db->jdate($objp->datec);

					$picto='bill';
					if ($objp->type == 1) $picto.='r';
					if ($objp->type == 2) $picto.='a';
					$late = '';
					if ($objp->paye == 0 && ($objp->fk_statut != 2 && $objp->fk_statut != 3) && $datelimite < ($now - $conf->facture->client->warning_delay)) { $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));}

					$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
                    'logo' => $picto,
                    'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);

					$this->info_box_contents[$i][1] = array('td' => 'align="left"',
                    'text' => $objp->facnumber,
                    'text2'=> $late,
                    'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);

					$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' => $objp->nom,
                    'maxlength'=>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" width="18"',
                    'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));

					$i++;
				}

				if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
			}
			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"));
		}
	}
Beispiel #8
0
 // Confirmation close
 if ($action == 'close') {
     print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $object->id, $langs->trans("CloseAProject"), $langs->trans("ConfirmCloseAProject"), "confirm_close", '', '', 1);
 }
 // Confirmation reopen
 if ($action == 'reopen') {
     print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $object->id, $langs->trans("ReOpenAProject"), $langs->trans("ConfirmReOpenAProject"), "confirm_reopen", '', '', 1);
 }
 // Confirmation delete
 if ($action == 'delete') {
     $text = $langs->trans("ConfirmDeleteAProject");
     $task = new Task($db);
     $taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
     $nboftask = count($taskarray);
     if ($nboftask) {
         $text .= '<br>' . img_warning() . ' ' . $langs->trans("ThisWillAlsoRemoveTasks", $nboftask);
     }
     print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $object->id, $langs->trans("DeleteAProject"), $text, "confirm_delete", '', '', 1);
 }
 // Clone confirmation
 if ($action == 'clone') {
     $formquestion = array('text' => $langs->trans("ConfirmClone"), array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true), array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true), array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true), array('type' => 'checkbox', 'name' => 'clone_notes', 'label' => $langs->trans("CloneNotes"), 'value' => true), array('type' => 'checkbox', 'name' => 'clone_project_files', 'label' => $langs->trans("CloneProjectFiles"), 'value' => false), array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false));
     print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $object->id, $langs->trans("CloneProject"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 240);
 }
 print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
 print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
 print '<input type="hidden" name="action" value="update">';
 print '<input type="hidden" name="id" value="' . $object->id . '">';
 print '<input type="hidden" name="comefromclone" value="' . $comefromclone . '">';
 $head = project_prepare_head($object);
 dol_fiche_head($head, 'project', $langs->trans("Project"), 0, $object->public ? 'projectpub' : 'project');
 /**
  * Return description of a module
  *
  * @param	Translate	$langs		Object language
  * @return	string      			Description
  */
 function info($langs)
 {
     global $conf, $langs;
     $langs->load("companies");
     $langs->load("errors");
     $form = new Form($db);
     $texte = $this->description . ".<br>\n";
     $texte .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
     $texte .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
     $texte .= '<input type="hidden" name="action" value="setModuleOptions">';
     $texte .= '<input type="hidden" name="param1" value="COMPANY_ADDON_PDF_ODT_PATH">';
     $texte .= '<table class="nobordernopadding" width="100%">';
     // List of directories area
     $texte .= '<tr><td>';
     $texttitle = $langs->trans("ListOfDirectories");
     $listofdir = explode(',', preg_replace('/[\\r\\n]+/', ',', trim($conf->global->COMPANY_ADDON_PDF_ODT_PATH)));
     $listoffiles = array();
     foreach ($listofdir as $key => $tmpdir) {
         $tmpdir = trim($tmpdir);
         $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
         if (!$tmpdir) {
             unset($listofdir[$key]);
             continue;
         }
         if (!is_dir($tmpdir)) {
             $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
         } else {
             $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\\.odt');
             if (count($tmpfiles)) {
                 $listoffiles = array_merge($listoffiles, $tmpfiles);
             }
         }
     }
     $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
     // Add list of substitution keys
     $texthelp .= '<br>' . $langs->trans("FollowingSubstitutionKeysCanBeUsed") . '<br>';
     $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation");
     // This contains an url, we don't modify it
     $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
     $texte .= '<table><tr><td>';
     $texte .= '<textarea class="flat" cols="60" name="value1">';
     $texte .= $conf->global->COMPANY_ADDON_PDF_ODT_PATH;
     $texte .= '</textarea>';
     $texte .= '</td>';
     $texte .= '<td align="center">&nbsp; ';
     $texte .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="Button">';
     $texte .= '</td>';
     $texte .= '</tr>';
     $texte .= '</table>';
     // Scan directories
     if (count($listofdir)) {
         $texte .= $langs->trans("NumberOfModelFilesFound") . ': <b>' . count($listoffiles) . '</b>';
     }
     $texte .= '</td>';
     $texte .= '<td valign="top" rowspan="2">';
     $texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
     $texte .= '</td>';
     $texte .= '</tr>';
     /*$texte.= '<tr><td align="center">';
     		$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
     		$texte.= '</td>';
     		$texte.= '</tr>';*/
     $texte .= '</table>';
     $texte .= '</form>';
     return $texte;
 }
Beispiel #10
0
                			print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
                			print '<input name="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$quantityToBeDelivered.'">';
                			print '</td>';
                			if ($line->product_type == 1) print '<td>&nbsp;</td>';
                		}*/
                print "</tr>\n";
                // Show subproducts of product
                if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) {
                    $product->get_sousproduits_arbo();
                    $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
                    if (sizeof($prods_arbo) > 0) {
                        foreach ($prods_arbo as $key => $value) {
                            //print $value[0];
                            $img = '';
                            if ($value['stock'] < $value['stock_alert']) {
                                $img = img_warning($langs->trans("StockTooLow"));
                            }
                            print "<tr " . $bc[$var] . "><td>&nbsp; &nbsp; &nbsp; ->\n                                <a href=\"" . DOL_URL_ROOT . "/product/fiche.php?id=" . $value['id'] . "\">" . $value['fullpath'] . "\n                                </a> (" . $value['nb'] . ")</td><td align=\"center\"> " . $value['nb_total'] . "</td><td>&nbsp</td><td>&nbsp</td>\n                                <td align=\"center\">" . $value['stock'] . " " . $img . "</td></tr>";
                        }
                    }
                }
                $indiceAsked++;
            }
            print '<tr><td align="center" colspan="5"><br><input type="submit" class="button" value="' . $langs->trans("Create") . '"></td></tr>';
            print "</table>";
            print '</form>';
        } else {
            dol_print_error($db);
        }
    }
} else {
Beispiel #11
0
print '</td>';
print '</tr>';
// Use anti virus
$var = !$var;
print "<tr " . $bc[$var] . ">";
print '<td colspan="2">' . $langs->trans("AntiVirusCommand") . '<br>';
print $langs->trans("AntiVirusCommandExample");
// Check command in inside safe_mode
print '</td>';
print '<td>';
if (ini_get('safe_mode') && !empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
    $langs->load("errors");
    $basedir = preg_replace('/"/', '', dirname($conf->global->MAIN_ANTIVIRUS_COMMAND));
    $listdir = explode(';', ini_get('safe_mode_exec_dir'));
    if (!in_array($basedir, $listdir)) {
        print img_warning($langs->trans('WarningSafeModeOnCheckExecDir'));
        dol_syslog("safe_mode is on, basedir is " . $basedir . ", safe_mode_exec_dir is " . ini_get('safe_mode_exec_dir'), LOG_WARNING);
    }
}
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="' . (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? dol_htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND) : '') . '">';
print "</td>";
print '</tr>';
// Use anti virus
$var = !$var;
print "<tr " . $bc[$var] . ">";
print '<td colspan="2">' . $langs->trans("AntiVirusParam") . '<br>';
print $langs->trans("AntiVirusParamExample");
print '</td>';
print '<td>';
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" size="72" value="' . (!empty($conf->global->MAIN_ANTIVIRUS_PARAM) ? dol_htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM) : '') . '">';
print "</td>";
Beispiel #12
0
                    print '<td align="right" width="10%">' . $pdluo->qty . ($pdluo->qty < 0 ? ' ' . img_warning() : '') . '</td>';
                    print '<td colspan="4"><input type="submit" class="button" id="savelinebutton" name="save" value="' . $langs->trans("Save") . '">';
                    print '<input type="submit" class="button" id="cancellinebutton" name="Cancel" value="' . $langs->trans("Cancel") . '"></td></tr>';
                    print '</table></form>';
                } else {
                    print "\n" . '<tr><td align="right">';
                    print img_picto($langs->trans("Tranfer"), 'uparrow', 'class="hideonsmartphone"') . ' ';
                    print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $product->id . '&amp;action=transfert&amp;pdluoid=' . $pdluo->id . '">' . $langs->trans("StockMovement") . '</a>';
                    // Disabled, because edition of stock content must use the "Correct stock menu".
                    // Do not use this, or data will be wrong (bad tracking of movement label, inventory code, ...
                    //print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=editline&amp;lineid='.$pdluo->id.'#'.$pdluo->id.'">';
                    //print img_edit().'</a></td>';
                    print '<td align="right">' . $pdluo->batch . '</td>';
                    print '<td align="center">' . dol_print_date($pdluo->eatby, 'day') . '</td>';
                    print '<td align="center">' . dol_print_date($pdluo->sellby, 'day') . '</td>';
                    print '<td align="right">' . $pdluo->qty . ($pdluo->qty < 0 ? ' ' . img_warning() : '') . '</td>';
                    print '<td colspan="4"></td></tr>';
                }
            }
        }
        $i++;
        $var = !$var;
    }
} else {
    dol_print_error($db);
}
print '<tr class="liste_total"><td align="right" class="liste_total" colspan="4">' . $langs->trans("Total") . ':</td>';
print '<td class="liste_total" align="right">' . $total . '</td>';
print '<td class="liste_total" align="right">';
print $totalwithpmp ? price(price2num($totalvalue / $totalwithpmp, 'MU')) : '&nbsp;';
// This value may have rounding errors
Beispiel #13
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;
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
     include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
     $propalstatic = new Propal($db);
     $societestatic = new Societe($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLast" . ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified") . "Propals", $max));
     if ($user->rights->propale->lire) {
         $sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo,";
         $sql .= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
         $sql .= ", " . MAIN_DB_PREFIX . "propal as p";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE p.fk_soc = s.rowid";
         $sql .= " AND p.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;
         }
         if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) {
             $sql .= " ORDER BY p.datep DESC, p.ref DESC ";
         } else {
             $sql .= " ORDER BY p.tms DESC, p.ref DESC ";
         }
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $now = dol_now();
             $line = 0;
             while ($line < $num) {
                 $objp = $db->fetch_object($result);
                 $date = $db->jdate($objp->dp);
                 $datec = $db->jdate($objp->datec);
                 $datem = $db->jdate($objp->tms);
                 $dateterm = $db->jdate($objp->fin_validite);
                 $dateclose = $db->jdate($objp->date_cloture);
                 $propalstatic->id = $objp->rowid;
                 $propalstatic->ref = $objp->ref;
                 $propalstatic->total_ht = $objp->total_ht;
                 $propalstatic->total_tva = $objp->total_tva;
                 $propalstatic->total_ttc = $objp->total_ttc;
                 $societestatic->id = $objp->socid;
                 $societestatic->name = $objp->name;
                 $societestatic->code_client = $objp->code_client;
                 $societestatic->logo = $objp->logo;
                 $late = '';
                 if ($objp->fk_statut == 1 && $dateterm < $now - $conf->propal->cloture->warning_delay) {
                     $late = img_warning($langs->trans("Late"));
                 }
                 $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $propalstatic->getNomUrl(1), 'text2' => $late, 'asis' => 1);
                 $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $societestatic->getNomUrl(1, '', 40), 'asis' => 1);
                 $this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency));
                 $this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => dol_print_date($date, 'day'));
                 $this->info_box_contents[$line][] = array('td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($objp->fk_statut, 3));
                 $line++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedProposals"));
             }
             $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"));
     }
 }
Beispiel #14
0
         print '. ' . $langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1));
         // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
     }
     print '<br>';
 }
 // Add invoice with payments
 if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
     print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"' . (!empty($bankviainvoice) ? ' checked' : '');
     //if (empty($object->fk_soc)) print ' disabled';
     print '> ' . $langs->trans("MoreActionBankViaInvoice");
     if ($object->fk_soc) {
         print ' (' . $langs->trans("ThirdParty") . ': ' . $company->getNomUrl(1) . ')';
     } else {
         print ' (';
         if (empty($object->fk_soc)) {
             print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
         }
         print $langs->trans("NoThirdPartyAssociatedToMember");
         print ' - <a href="' . $_SERVER["PHP_SELF"] . '?rowid=' . $object->id . '&amp;action=create_thirdparty">';
         print $langs->trans("CreateDolibarrThirdParty");
         print '</a>)';
     }
     if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') {
         print '. ' . $langs->trans("NoVatOnSubscription", 0);
     }
     if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
         $prodtmp = new Product($db);
         $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
         print '. ' . $langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1));
         // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
     }
Beispiel #15
0
         continue;
     }
     $param = 'NOTIFICATION_FIXEDEMAIL_' . $notifiedevent['code'] . '_THRESHOLD_HIGHER_' . $reg[1];
     $value = GETPOST('NOTIF_' . $notifiedevent['code'] . '_old_' . $reg[1] . '_key') ? GETPOST('NOTIF_' . $notifiedevent['code'] . '_old_' . $reg[1] . '_key', 'alpha') : $conf->global->{$param};
     $s = '<input type="text" size="32" name="NOTIF_' . $notifiedevent['code'] . '_old_' . $reg[1] . '_key" value="' . dol_escape_htmltag($value) . '">';
     // Do not use type="email" here, we must be able to enter a list of email with , separator.
     $arrayemail = explode(',', $value);
     $showwarning = 0;
     foreach ($arrayemail as $key => $valuedet) {
         $valuedet = trim($valuedet);
         if (!empty($valuedet) && !isValidEmail($valuedet, 1)) {
             $showwarning++;
         }
     }
     if (!empty($conf->global->{$param}) && $showwarning) {
         $s .= ' ' . img_warning($langs->trans("ErrorBadEMail"));
     }
     print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients") . '<br>' . $langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
     print '<br>';
 }
 // New entry input fields
 $s = '<input type="text" size="32" name="NOTIF_' . $notifiedevent['code'] . '_new_key" value="">';
 // Do not use type="email" here, we must be able to enter a list of email with , separator.
 print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients") . '<br>' . $langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
 print '</td>';
 print '<td>';
 // Notification with threshold
 foreach ($conf->global as $key => $val) {
     if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_' . $notifiedevent['code'] . '_THRESHOLD_HIGHER_(.*)/', $key, $reg)) {
         continue;
     }
 /**
  *      Return a string to show the box with list of available documents for object.
  *      This also set the property $this->numoffiles
  *
  *      @param      string				$modulepart         Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule_temp', ...)
  *      @param      string				$modulesubdir       Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
  *      @param      string				$filedir            Directory to scan
  *      @param      string				$urlsource          Url of origin page (for return)
  *      @param      int					$genallowed         Generation is allowed (1/0 or array list of templates)
  *      @param      int					$delallowed         Remove is allowed (1/0)
  *      @param      string				$modelselected      Model to preselect by default
  *      @param      string				$allowgenifempty	Allow generation even if list of template ($genallowed) is empty (show however a warning)
  *      @param      string				$forcenomultilang	Do not show language option (even if MAIN_MULTILANGS defined)
  *      @param      int					$iconPDF            Deprecated, see getDocumentsLink
  * 		@param		int					$maxfilenamelength	Max length for filename shown
  * 		@param		string				$noform				Do not output html form tags
  * 		@param		string				$param				More param on http links
  * 		@param		string				$title				Title to show on top of form
  * 		@param		string				$buttonlabel		Label on submit button
  * 		@param		string				$codelang			Default language code to use on lang combo box if multilang is enabled
  * 		@param		string				$morepicto			Add more HTML content into cell with picto
  * 		@return		string              					Output string with HTML array of documents (might be empty string)
  */
 function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $maxfilenamelength = 28, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '')
 {
     // Deprecation warning
     if (0 !== $iconPDF) {
         dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING);
     }
     global $langs, $conf, $user, $hookmanager;
     global $form, $bc;
     if (!is_object($form)) {
         $form = new Form($this->db);
     }
     include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
     // For backward compatibility
     if (!empty($iconPDF)) {
         return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir);
     }
     $printer = 0;
     if (in_array($modulepart, array('facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur'))) {
         $printer = !empty($user->rights->printing->read) && !empty($conf->printing->enabled) ? true : false;
     }
     $hookmanager->initHooks(array('formfile'));
     $forname = 'builddoc';
     $out = '';
     $var = true;
     $headershown = 0;
     $showempty = 0;
     $i = 0;
     $titletoshow = $langs->trans("Documents");
     if (!empty($title)) {
         $titletoshow = $title;
     }
     $out .= "\n" . '<!-- Start show_document -->' . "\n";
     //print 'filedir='.$filedir;
     // Show table
     if ($genallowed) {
         $modellist = array();
         if ($modulepart == 'company') {
             $showempty = 1;
             if (is_array($genallowed)) {
                 $modellist = $genallowed;
             } else {
                 include_once DOL_DOCUMENT_ROOT . '/core/modules/societe/modules_societe.class.php';
                 $modellist = ModeleThirdPartyDoc::liste_modeles($this->db);
             }
         } else {
             if ($modulepart == 'propal') {
                 if (is_array($genallowed)) {
                     $modellist = $genallowed;
                 } else {
                     include_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php';
                     $modellist = ModelePDFPropales::liste_modeles($this->db);
                 }
             } else {
                 if ($modulepart == 'supplier_proposal') {
                     if (is_array($genallowed)) {
                         $modellist = $genallowed;
                     } else {
                         include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_proposal/modules_supplier_proposal.php';
                         $modellist = ModelePDFSupplierProposal::liste_modeles($this->db);
                     }
                 } else {
                     if ($modulepart == 'commande') {
                         if (is_array($genallowed)) {
                             $modellist = $genallowed;
                         } else {
                             include_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php';
                             $modellist = ModelePDFCommandes::liste_modeles($this->db);
                         }
                     } elseif ($modulepart == 'expedition') {
                         if (is_array($genallowed)) {
                             $modellist = $genallowed;
                         } else {
                             include_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php';
                             $modellist = ModelePDFExpedition::liste_modeles($this->db);
                         }
                     } elseif ($modulepart == 'livraison') {
                         if (is_array($genallowed)) {
                             $modellist = $genallowed;
                         } else {
                             include_once DOL_DOCUMENT_ROOT . '/core/modules/livraison/modules_livraison.php';
                             $modellist = ModelePDFDeliveryOrder::liste_modeles($this->db);
                         }
                     } else {
                         if ($modulepart == 'ficheinter') {
                             if (is_array($genallowed)) {
                                 $modellist = $genallowed;
                             } else {
                                 include_once DOL_DOCUMENT_ROOT . '/core/modules/fichinter/modules_fichinter.php';
                                 $modellist = ModelePDFFicheinter::liste_modeles($this->db);
                             }
                         } elseif ($modulepart == 'facture') {
                             if (is_array($genallowed)) {
                                 $modellist = $genallowed;
                             } else {
                                 include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
                                 $modellist = ModelePDFFactures::liste_modeles($this->db);
                             }
                         } elseif ($modulepart == 'contract') {
                             if (is_array($genallowed)) {
                                 $modellist = $genallowed;
                             } else {
                                 include_once DOL_DOCUMENT_ROOT . '/core/modules/contract/modules_contract.php';
                                 $modellist = ModelePDFContract::liste_modeles($this->db);
                             }
                         } elseif ($modulepart == 'project') {
                             if (is_array($genallowed)) {
                                 $modellist = $genallowed;
                             } else {
                                 include_once DOL_DOCUMENT_ROOT . '/core/modules/project/modules_project.php';
                                 $modellist = ModelePDFProjects::liste_modeles($this->db);
                             }
                         } elseif ($modulepart == 'project_task') {
                             if (is_array($genallowed)) {
                                 $modellist = $genallowed;
                             } else {
                                 include_once DOL_DOCUMENT_ROOT . '/core/modules/project/task/modules_task.php';
                                 $modellist = ModelePDFTask::liste_modeles($this->db);
                             }
                         } elseif ($modulepart == 'export') {
                             if (is_array($genallowed)) {
                                 $modellist = $genallowed;
                             } else {
                                 include_once DOL_DOCUMENT_ROOT . '/core/modules/export/modules_export.php';
                                 $modellist = ModeleExports::liste_modeles($this->db);
                             }
                         } else {
                             if ($modulepart == 'commande_fournisseur') {
                                 if (is_array($genallowed)) {
                                     $modellist = $genallowed;
                                 } else {
                                     include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_order/modules_commandefournisseur.php';
                                     $modellist = ModelePDFSuppliersOrders::liste_modeles($this->db);
                                 }
                             } else {
                                 if ($modulepart == 'facture_fournisseur') {
                                     if (is_array($genallowed)) {
                                         $modellist = $genallowed;
                                     } else {
                                         include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
                                         $modellist = ModelePDFSuppliersInvoices::liste_modeles($this->db);
                                     }
                                 } else {
                                     if ($modulepart == 'remisecheque') {
                                         if (is_array($genallowed)) {
                                             $modellist = $genallowed;
                                         } else {
                                             include_once DOL_DOCUMENT_ROOT . '/core/modules/cheque/pdf/modules_chequereceipts.php';
                                             $modellist = ModeleChequeReceipts::liste_modeles($this->db);
                                         }
                                     } elseif ($modulepart == 'donation') {
                                         if (is_array($genallowed)) {
                                             $modellist = $genallowed;
                                         } else {
                                             include_once DOL_DOCUMENT_ROOT . '/core/modules/dons/modules_don.php';
                                             $modellist = ModeleDon::liste_modeles($this->db);
                                         }
                                     } else {
                                         if ($modulepart == 'unpaid') {
                                             $modellist = '';
                                         } else {
                                             if ($modulepart != 'agenda') {
                                                 // For normalized standard modules
                                                 $file = dol_buildpath('/core/modules/' . $modulepart . '/modules_' . $modulepart . '.php', 0);
                                                 if (file_exists($file)) {
                                                     $res = (include_once $file);
                                                 } else {
                                                     $file = dol_buildpath('/' . $modulepart . '/core/modules/' . $modulepart . '/modules_' . $modulepart . '.php', 0);
                                                     $res = (include_once $file);
                                                 }
                                                 $class = 'Modele' . ucfirst($modulepart);
                                                 if (class_exists($class)) {
                                                     $modellist = call_user_func($class . '::liste_modeles', $this->db);
                                                 } else {
                                                     dol_print_error($this->db, 'Bad value for modulepart');
                                                     return -1;
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $headershown = 1;
         $buttonlabeltoshow = $buttonlabel;
         if (empty($buttonlabel)) {
             $buttonlabel = $langs->trans('Generate');
         }
         if (empty($noform)) {
             $out .= '<form action="' . $urlsource . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc') . '" name="' . $forname . '" id="' . $forname . '_form" method="post">';
         }
         $out .= '<input type="hidden" name="action" value="builddoc">';
         $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
         $out .= load_fiche_titre($titletoshow, '', '');
         $out .= '<table class="liste formdoc noborder" summary="listofdocumentstable" width="100%">';
         $out .= '<tr class="liste_titre">';
         // Model
         if (!empty($modellist)) {
             $out .= '<th align="center" class="formdoc liste_titre maxwidthonsmartphone">';
             $out .= '<span class="hideonsmartphone">' . $langs->trans('Model') . ' </span>';
             if (is_array($modellist) && count($modellist) == 1) {
                 $arraykeys = array_keys($modellist);
                 $modelselected = $arraykeys[0];
             }
             $out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', '');
             $out .= '</th>';
         } else {
             $out .= '<th align="left" class="formdoc liste_titre">';
             $out .= $langs->trans("Files");
             $out .= '</th>';
         }
         // Language code (if multilang)
         $out .= '<th align="center" class="formdoc liste_titre maxwidthonsmartphone">';
         if (($allowgenifempty || is_array($modellist) && count($modellist) > 0) && $conf->global->MAIN_MULTILANGS && !$forcenomultilang && (!empty($modellist) || $showempty)) {
             include_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php';
             $formadmin = new FormAdmin($this->db);
             $defaultlang = $codelang ? $codelang : $langs->getDefaultLang();
             $morecss = 'maxwidth150';
             if (!empty($conf->browser->phone)) {
                 $morecss = 'maxwidth100';
             }
             $out .= $formadmin->select_language($defaultlang, 'lang_id', 0, 0, 0, 0, 0, $morecss);
         } else {
             $out .= '&nbsp;';
         }
         $out .= '</th>';
         // Button
         $addcolumforpicto = $delallowed || $printer || $morepicto;
         $out .= '<th align="center" colspan="' . ($addcolumforpicto ? '2' : '1') . '" class="formdocbutton liste_titre maxwidthonsmartphone">';
         $genbutton = '<input class="button" id="' . $forname . '_generatebutton" name="' . $forname . '_generatebutton"';
         $genbutton .= ' type="submit" value="' . $buttonlabel . '"';
         if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) {
             $genbutton .= ' disabled';
         }
         $genbutton .= '>';
         if ($allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') {
             $langs->load("errors");
             $genbutton .= ' ' . img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated"));
         }
         if (!$allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') {
             $genbutton = '';
         }
         if (empty($modellist) && !$showempty && $modulepart != 'unpaid') {
             $genbutton = '';
         }
         $out .= $genbutton;
         $out .= '</th>';
         if (!empty($hookmanager->hooks['formfile'])) {
             foreach ($hookmanager->hooks['formfile'] as $module) {
                 if (method_exists($module, 'formBuilddocLineOptions')) {
                     $out .= '<th></th>';
                 }
             }
         }
         $out .= '</tr>';
         // Execute hooks
         $parameters = array('socid' => isset($GLOBALS['socid']) ? $GLOBALS['socid'] : '', 'id' => isset($GLOBALS['id']) ? $GLOBALS['id'] : '', 'modulepart' => $modulepart);
         if (is_object($hookmanager)) {
             $reshook = $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']);
             $out .= $hookmanager->resPrint;
         }
     }
     // Get list of files
     if (!empty($filedir)) {
         $file_list = dol_dir_list($filedir, 'files', 0, '', '(\\.meta|_preview\\.png)$', 'date', SORT_DESC);
         // Affiche en-tete tableau si non deja affiche
         if (!empty($file_list) && !$headershown) {
             $headershown = 1;
             $out .= '<div class="titre">' . $titletoshow . '</div>';
             $out .= '<table class="border" summary="listofdocumentstable" width="100%">';
         }
         // Loop on each file found
         if (is_array($file_list)) {
             foreach ($file_list as $file) {
                 $var = !$var;
                 // Define relative path for download link (depends on module)
                 $relativepath = $file["name"];
                 // Cas general
                 if ($modulesubdir) {
                     $relativepath = $modulesubdir . "/" . $file["name"];
                 }
                 // Cas propal, facture...
                 if ($modulepart == 'export') {
                     $relativepath = $file["name"];
                 }
                 // Other case
                 $out .= "<tr " . $bc[$var] . ">";
                 $documenturl = DOL_URL_ROOT . '/document.php';
                 if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
                     $documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
                 }
                 // Show file name with link to download
                 $out .= '<td class="nowrap">';
                 $out .= '<a data-ajax="false" href="' . $documenturl . '?modulepart=' . $modulepart . '&amp;file=' . urlencode($relativepath) . '"';
                 $mime = dol_mimetype($relativepath, '', 0);
                 if (preg_match('/text/', $mime)) {
                     $out .= ' target="_blank"';
                 }
                 $out .= ' target="_blank">';
                 $out .= img_mime($file["name"], $langs->trans("File") . ': ' . $file["name"]) . ' ' . dol_trunc($file["name"], $maxfilenamelength);
                 $out .= '</a>' . "\n";
                 $out .= '</td>';
                 // Show file size
                 $size = !empty($file['size']) ? $file['size'] : dol_filesize($filedir . "/" . $file["name"]);
                 $out .= '<td align="right" class="nowrap">' . dol_print_size($size) . '</td>';
                 // Show file date
                 $date = !empty($file['date']) ? $file['date'] : dol_filemtime($filedir . "/" . $file["name"]);
                 $out .= '<td align="right" class="nowrap">' . dol_print_date($date, 'dayhour', 'tzuser') . '</td>';
                 if ($delallowed || $printer || $morepicto) {
                     $out .= '<td align="right">';
                     if ($delallowed) {
                         $out .= '<a href="' . $urlsource . (strpos($urlsource, '?') ? '&amp;' : '?') . 'action=remove_file&amp;file=' . urlencode($relativepath);
                         $out .= $param ? '&amp;' . $param : '';
                         //$out.= '&modulepart='.$modulepart; // TODO obsolete ?
                         //$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ?
                         $out .= '">' . img_picto($langs->trans("Delete"), 'delete.png') . '</a>';
                         //$out.='</td>';
                     }
                     if ($printer) {
                         //$out.= '<td align="right">';
                         $out .= '&nbsp;<a href="' . $urlsource . (strpos($urlsource, '?') ? '&amp;' : '?') . 'action=print_file&amp;printer=' . $modulepart . '&amp;file=' . urlencode($relativepath);
                         $out .= $param ? '&amp;' . $param : '';
                         $out .= '">' . img_picto($langs->trans("PrintFile", $relativepath), 'printer.png') . '</a>';
                     }
                     if ($morepicto) {
                         $morepicto = preg_replace('/__FILENAMEURLENCODED__/', urlencode($relativepath), $morepicto);
                         $out .= $morepicto;
                     }
                     $out .= '</td>';
                 }
                 if (is_object($hookmanager)) {
                     $parameters = array('socid' => isset($GLOBALS['socid']) ? $GLOBALS['socid'] : '', 'id' => isset($GLOBALS['id']) ? $GLOBALS['id'] : '', 'modulepart' => $modulepart, 'relativepath' => $relativepath);
                     $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file);
                     if (empty($res)) {
                         $out .= $hookmanager->resPrint;
                         // Complete line
                         $out .= '</tr>';
                     } else {
                         $out = $hookmanager->resPrint;
                     }
                     // Replace line
                 }
             }
             if (count($file_list) == 0 && $headershown) {
                 $out .= '<tr ' . $bc[0] . '><td colspan="3">' . $langs->trans("None") . '</td></tr>';
             }
             $this->numoffiles++;
         }
     }
     if ($headershown) {
         // Affiche pied du tableau
         $out .= "</table>\n";
         if ($genallowed) {
             if (empty($noform)) {
                 $out .= '</form>' . "\n";
             }
         }
     }
     $out .= '<!-- End show_document -->' . "\n";
     //return ($i?$i:$headershown);
     return $out;
 }
 /**
  *	Return description of a module
  *
  *	@param	Translate	$langs      Lang object to use for output
  *	@return string       			Description
  */
 function info($langs)
 {
     global $conf, $langs;
     $langs->load("companies");
     $langs->load("errors");
     $form = new Form($this->db);
     $texte = $this->description . ".<br>\n";
     $texte .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
     $texte .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
     $texte .= '<input type="hidden" name="action" value="setModuleOptions">';
     $texte .= '<input type="hidden" name="param1" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH">';
     if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) {
         $texte .= '<input type="hidden" name="param2" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT">';
         $texte .= '<input type="hidden" name="param3" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL">';
         $texte .= '<input type="hidden" name="param4" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED">';
     }
     $texte .= '<table class="nobordernopadding" width="100%">';
     // List of directories area
     $texte .= '<tr><td>';
     $texttitle = $langs->trans("ListOfDirectories");
     $listofdir = explode(',', preg_replace('/[\\r\\n]+/', ',', trim($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH)));
     $listoffiles = array();
     foreach ($listofdir as $key => $tmpdir) {
         $tmpdir = trim($tmpdir);
         $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
         if (!$tmpdir) {
             unset($listofdir[$key]);
             continue;
         }
         if (!is_dir($tmpdir)) {
             $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
         } else {
             $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\\.(ods|odt)');
             if (count($tmpfiles)) {
                 $listoffiles = array_merge($listoffiles, $tmpfiles);
             }
         }
     }
     $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
     // Add list of substitution keys
     $texthelp .= '<br>' . $langs->trans("FollowingSubstitutionKeysCanBeUsed") . '<br>';
     $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation");
     // This contains an url, we don't modify it
     $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
     $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
     $texte .= '<textarea class="flat" cols="60" name="value1">';
     $texte .= $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH;
     $texte .= '</textarea>';
     $texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
     $texte .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="Button">';
     $texte .= '<br></div></div>';
     // Scan directories
     if (count($listofdir)) {
         $texte .= $langs->trans("NumberOfModelFilesFound") . ': <b>' . count($listoffiles) . '</b>';
         if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) {
             // Model for creation
             $liste = ModelePDFSupplierProposal::liste_modeles($this->db);
             $texte .= '<table width="50%;">';
             $texte .= '<tr>';
             $texte .= '<td width="60%;">' . $langs->trans("DefaultModelSupplierProposalCreate") . '</td>';
             $texte .= '<td colspan="">';
             $texte .= $form->selectarray('value2', $liste, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT);
             $texte .= "</td></tr>";
             $texte .= '<tr>';
             $texte .= '<td width="60%;">' . $langs->trans("DefaultModelSupplierProposalToBill") . '</td>';
             $texte .= '<td colspan="">';
             $texte .= $form->selectarray('value3', $liste, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL);
             $texte .= "</td></tr>";
             $texte .= '<tr>';
             $texte .= '<td width="60%;">' . $langs->trans("DefaultModelSupplierProposalClosed") . '</td>';
             $texte .= '<td colspan="">';
             $texte .= $form->selectarray('value4', $liste, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED);
             $texte .= "</td></tr>";
             $texte .= '</table>';
         }
     }
     $texte .= '</td>';
     $texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">';
     $texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
     $texte .= '</td>';
     $texte .= '</tr>';
     $texte .= '</table>';
     $texte .= '</form>';
     return $texte;
 }
                }
            }
        }
        closedir($handle);
    } else {
        dol_syslog("htdocs/admin/modules.php: Failed to open directory " . $dir . ". See permission and open_basedir option.", LOG_WARNING);
    }
}
asort($orders);
//var_dump($orders);
//var_dump($categ);
//var_dump($modules);
$nbofactivatedmodules = count($conf->modules);
$moreinfo = $langs->trans("TotalNumberOfActivatedModules", $nbofactivatedmodules - 1);
if ($nbofactivatedmodules <= 1) {
    $moreinfo .= ' ' . img_warning($langs->trans("YouMustEnableOneModule"));
}
print load_fiche_titre($langs->trans("ModulesSetup"), $moreinfo, 'setup');
// Start to show page
if (empty($mode)) {
    $mode = 'common';
}
if ($mode === 'common') {
    print $langs->trans("ModulesDesc") . "<br>\n";
}
if ($mode === 'other') {
    print $langs->trans("ModulesSpecialDesc") . "<br>\n";
}
if ($mode === 'interfaces') {
    print $langs->trans("ModulesInterfaceDesc") . "<br>\n";
}
Beispiel #19
0
         $var = true;
         $num = $db->num_rows($resql);
         if ($num > 0) {
             print '<tr class="liste_titre">';
             print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastPropals", $num <= $MAXLIST ? "" : $MAXLIST) . '</td><td align="right"><a href="' . DOL_URL_ROOT . '/comm/propal.php?socid=' . $objsoc->id . '">' . $langs->trans("AllPropals") . ' (' . $num . ')</a></td>';
             print '<td width="20px" align="right"><a href="' . DOL_URL_ROOT . '/comm/propal/stats/index.php?socid=' . $objsoc->id . '">' . img_picto($langs->trans("Statistics"), 'stats') . '</a></td>';
             print '</tr></table></td>';
             print '</tr>';
         }
         $i = 0;
         while ($i < $num && $i < $MAXLIST) {
             $objp = $db->fetch_object($resql);
             print "<tr {$bc[$var]}>";
             print "<td nowrap><a href=\"propal.php?id={$objp->propalid}\">" . img_object($langs->trans("ShowPropal"), "propal") . " " . $objp->ref . "</a>\n";
             if ($db->jdate($objp->dp) < $now - $conf->propal->cloture->warning_delay && $objp->fk_statut == 1) {
                 print " " . img_warning();
             }
             print '</td><td align="right" width="80">' . dol_print_date($db->jdate($objp->dp), 'day') . "</td>\n";
             print '<td align="right" width="120">' . price($objp->total_ht) . '</td>';
             print '<td align="right" nowrap="nowrap">' . $propal_static->LibStatut($objp->fk_statut, 5) . '</td></tr>';
             $var = !$var;
             $i++;
         }
         $db->free($resql);
     } else {
         dol_print_error($db);
     }
     print "</table>";
 }
 /*
  * Last orders
Beispiel #20
0
		// End of subscription date
		if ($datefin)
		{
			print '<td align="center" nowrap="nowrap">';
			print dol_print_date($datefin,'day');
			if ($datefin < ($now -  $conf->adherent->cotisation->warning_delay) && $objp->statut > 0) print " ".img_warning($langs->trans("SubscriptionLate"));
			print '</td>';
		}
		else
		{
			print '<td align="left" nowrap="nowrap">';
			if ($objp->cotisation == 'yes')
			{
				print $langs->trans("SubscriptionNotReceived");
				if ($objp->statut > 0) print " ".img_warning();
			}
			else
			{
				print '&nbsp;';
			}
			print '</td>';
		}

		// Actions
		print '<td align="center">';
		if ($user->rights->adherent->creer)
		{
			print "<a href=\"fiche.php?rowid=$objp->rowid&action=edit&return=liste.php\">".img_edit()."</a>";
		}
		print '&nbsp;';
 /**
  *  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;
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.facture.class.php";
     $facturestatic = new FactureFournisseur($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLastSupplierBills", $max));
     if ($user->rights->fournisseur->facture->lire) {
         $sql = "SELECT s.nom, s.rowid as socid,";
         $sql .= " f.rowid as facid, f.facnumber, f.amount,";
         $sql .= " f.paye, f.fk_statut,";
         $sql .= ' f.datef as df,';
         $sql .= ' f.datec as datec,';
         $sql .= ' f.date_lim_reglement as datelimite, f.tms, f.type';
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
         $sql .= ", " . MAIN_DB_PREFIX . "facture_fourn as f";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE f.fk_soc = s.rowid";
         $sql .= " AND f.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 f.tms DESC";
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             $now = dol_now();
             $i = 0;
             $l_due_date = $langs->trans('Late') . ' (' . strtolower($langs->trans('DateEcheance')) . ': %s)';
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $datelimite = $db->jdate($objp->datelimite);
                 $datec = $db->jdate($objp->datec);
                 $late = '';
                 if ($objp->paye == 0 && $datelimite < $now - $conf->facture->fournisseur->warning_delay) {
                     $late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day')));
                 }
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/fourn/facture/fiche.php?facid=" . $objp->facid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->facnumber, 'text2' => $late, 'url' => DOL_URL_ROOT . "/fourn/facture/fiche.php?facid=" . $objp->facid);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datec, 'day'));
                 $fac = new FactureFournisseur($db);
                 $fac->fetch($objp->facid);
                 $alreadypaid = $fac->getSommePaiement();
                 $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type));
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoModifiedSupplierBills"));
             }
         } else {
             dol_print_error($db);
         }
     } else {
         $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->transnoentities("ReadPermissionNotAllowed"));
     }
 }
Beispiel #22
0
     if ($subj == 0) {
         print '<tr><td colspan="3" ></td><td align="center">';
         if ($line->product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
             //$disabled='disabled="disabled"';
             print '<input name="qtyl' . $indiceAsked . '_' . $subj . '" id="qtyl' . $indiceAsked . '_' . $subj . '" type="text" size="4" value="0"' . ($disabled ? ' ' . $disabled : '') . '> ';
         } else {
             print $langs->trans("NA");
         }
         print '</td>';
         print '<td align="left">';
         if ($line->product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
             if ($warehouseObject) {
                 print img_warning() . ' ' . $langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle);
             } else {
                 if ($line->fk_product) {
                     print img_warning() . ' ' . $langs->trans("StockTooLow");
                 } else {
                     print '';
                 }
             }
         } else {
             print $langs->trans("Service");
         }
         print '</td>';
         print '</tr>';
     }
 }
 //Display lines extrafields
 if (is_array($extralabelslines) && count($extralabelslines) > 0) {
     $colspan = 5;
     $line = new ExpeditionLigne($db);
 /**
  *  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;
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
     $productstatic = new Product($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleProductsAlertStock", $max));
     if ($user->rights->produit->lire || $user->rights->service->lire) {
         $sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,";
         $sql .= " SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ") as total_stock";
         $sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
         $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as s on p.rowid = s.fk_product";
         $sql .= ' WHERE p.entity IN (' . getEntity($productstatic->element, 1) . ')';
         $sql .= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
         if (empty($user->rights->produit->lire)) {
             $sql .= ' AND p.fk_product_type != 0';
         }
         if (empty($user->rights->service->lire)) {
             $sql .= ' AND p.fk_product_type != 1';
         }
         $sql .= " GROUP BY p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte";
         $sql .= " HAVING SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ") < p.seuil_stock_alerte";
         $sql .= $db->order('p.seuil_stock_alerte', 'DESC');
         $sql .= $db->plimit($max, 0);
         $result = $db->query($sql);
         if ($result) {
             $langs->load("stocks");
             $num = $db->num_rows($result);
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $datem = $db->jdate($objp->tms);
                 // Multilangs
                 if (!empty($conf->global->MAIN_MULTILANGS)) {
                     $sqld = "SELECT label";
                     $sqld .= " FROM " . MAIN_DB_PREFIX . "product_lang";
                     $sqld .= " WHERE fk_product=" . $objp->rowid;
                     $sqld .= " AND lang='" . $langs->getDefaultLang() . "'";
                     $sqld .= " LIMIT 1";
                     $resultd = $db->query($sqld);
                     if ($resultd) {
                         $objtp = $db->fetch_object($resultd);
                         if (isset($objtp->label) && $objtp->label != '') {
                             $objp->label = $objtp->label;
                         }
                     }
                 }
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $objp->fk_product_type == 1 ? 'object_service' : 'object_product', 'url' => DOL_URL_ROOT . "/product/card.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->label, 'url' => DOL_URL_ROOT . "/product/card.php?id=" . $objp->rowid);
                 if ($objp->price_base_type == 'HT') {
                     $price = price($objp->price);
                     $price_base_type = $langs->trans("HT");
                 } else {
                     $price = price($objp->price_ttc);
                     $price_base_type = $langs->trans("TTC");
                 }
                 $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => $price);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"', 'text' => $price_base_type);
                 $this->info_box_contents[$i][4] = array('td' => 'align="center"', 'text' => $objp->total_stock . ' / ' . $objp->seuil_stock_alerte, 'text2' => img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit")));
                 $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $productstatic->LibStatut($objp->tosell, 3, 0));
                 $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', 'text' => $productstatic->LibStatut($objp->tobuy, 3, 1));
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoTooLowStockProducts"));
             }
             $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"));
     }
 }
Beispiel #24
0
			{
				$obj = $db->fetch_object($resql);


				print '<tr '.$bc[$var].'>';
				print '<td nowrap="nowrap">';

				print '<table class="nobordernopadding"><tr class="nocellnopadd">';
				print '<td width="100" class="nobordernopadding" nowrap="nowrap">';
				$facturestatic->ref=$obj->facnumber;
				$facturestatic->id=$obj->rowid;
				$facturestatic->type=$obj->type;
				print $facturestatic->getNomUrl(1,'');
				print '</td>';
				print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
				if ($db->jdate($obj->datelimite) < ($now - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
				print '</td>';
				print '<td width="16" align="right" class="nobordernopadding">';
				$filename=dol_sanitizeFileName($obj->facnumber);
				$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
				$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
				$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1);
				print '</td></tr></table>';

				print '</td>';
				print '<td align="left">' ;
                $societestatic->id=$obj->socid;
                $societestatic->nom=$obj->nom;
                $societestatic->client=1;
				print $societestatic->getNomUrl(1,'customer',44) ;
				print '</a></td>';
		<div id="div_container_exportoptions">
		<fieldset id="exportoptions"><legend><?php 
echo $langs->trans("ExportMethod");
?>
</legend>
		<?php 
if ($label == 'MySQL') {
    ?>
			<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />
			<label for="radio_dump_mysql">MySQL	Dump (mysqldump)</label>
			</div>
			<br>
			<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />
			<label for="radio_dump_mysql">MySQL Dump (php) <?php 
    print img_warning($langs->trans('BackupPHPWarning'));
    ?>
</label>
			</div>
			<?php 
} else {
    if ($label == 'PostgreSQL') {
        ?>
			<div class="formelementrow"><input type="radio" name="what"	value="postgresql" id="radio_dump_postgresql" />
			<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>
			</div>
			<?php 
    } else {
        print 'No method available with database ' . $label;
    }
}
 $num = $db->num_rows($resql);
 $i = 0;
 $contactstatic = new Contact($db);
 while ($i < $num) {
     $var = !$var;
     $obj = $db->fetch_object($resql);
     $contactstatic->id = $obj->contactid;
     $contactstatic->lastname = $obj->lastname;
     $contactstatic->firstname = $obj->firstname;
     print '<tr ' . $bc[$var] . '><td>' . $contactstatic->getNomUrl(1);
     if ($obj->type == 'email') {
         if (isValidEmail($obj->email)) {
             print ' &lt;' . $obj->email . '&gt;';
         } else {
             $langs->load("errors");
             print ' &nbsp; ' . img_warning() . ' ' . $langs->trans("ErrorBadEMail", $obj->email);
         }
     }
     print '</td>';
     print '<td>';
     $label = $langs->trans("Notify_" . $obj->code) != "Notify_" . $obj->code ? $langs->trans("Notify_" . $obj->code) : $obj->label;
     print $label;
     print '</td>';
     print '<td>';
     if ($obj->type == 'email') {
         print $langs->trans("Email");
     }
     if ($obj->type == 'sms') {
         print $langs->trans("SMS");
     }
     print '</td>';
Beispiel #27
0
         print $objp->desiredstock;
     }
     print '</td>';
 }
 // Desired stock
 if (!empty($arrayfields['p.tobatch']['checked'])) {
     print '<td align="center">';
     print yn($objp->tobatch);
     print '</td>';
 }
 // Stock
 if (!empty($arrayfields['p.stock']['checked'])) {
     print '<td align="right">';
     if ($objp->fk_product_type != 1) {
         if ($product_static->stock_reel < $objp->seuil_stock_alerte) {
             print img_warning($langs->trans("StockTooLow")) . ' ';
         }
         print $product_static->stock_reel;
     }
     print '</td>';
 }
 // Accountancy code sell
 if (!empty($arrayfields['p.accountancy_code_sell']['checked'])) {
     print '<td>' . $objp->accountancy_code_sell . '</td>';
 }
 // Accountancy code sell
 if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) {
     print '<td>' . $objp->accountancy_code_buy . '</td>';
 }
 // Extra fields
 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
Beispiel #28
0
			$var=!$var;
			print "<tr $bc[$var]>";
			print '<td nowrap="nowrap">';

			$propalstatic->id=$objp->propalid;
			$propalstatic->ref=$objp->ref;

			//Ref
			print '<table class="nobordernopadding"><tr class="nocellnopadd">';
			print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
			print $propalstatic->getNomUrl(1, '', "&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder");
			print '</td>';

			print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
			if ($objp->fk_statut == 1 && $db->jdate($objp->dfin) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
			print '</td>';

			print '<td width="16" align="right" class="nobordernopadding">';

			$filename=dol_sanitizeFileName($objp->ref);
			$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
			$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->propalid;
			$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);

			print '</td></tr></table>';

			print "</td>\n";

			// Societe
			print "<td>";
Beispiel #29
0
			if ($conf->stock->enabled)
			{
				$stock = $product->stock_warehouse[$_GET["entrepot_id"]]->real;
				$stock+=0;  // Convertit en numerique

				// Quantite a livrer
				print '<td align="center">';
				print '<input name="idl'.$i.'" type="hidden" value="'.$line->id.'">';
				print '<input name="qtyl'.$i.'" type="text" size="6" value="'.min($quantite_a_livrer, $stock).'">';
				print '</td>';

				// Stock
				if ($stock < $quantite_a_livrer)
				{
					print '<td align="center">'.$stock.' '.img_warning().'</td>';
				}
				else
				{
					print '<td align="center">'.$stock.'</td>';
				}
			}
			else
			{
				// Quantite a livrer
				print '<td align="center">';
				print '<input name="idl'.$i.'" type="hidden" value="'.$line->id.'">';
				print '<input name="qtyl'.$i.'" type="text" size="6" value="'.$quantite_a_livrer.'">';
				print '</td>';
			}
Beispiel #30
0
				$obj = $db->fetch_object($result);
				$var=!$var;
				print '<tr '.$bc[$var].'>';

				// Ref
				print '<td nowrap="nowrap" width="140">';

				$propalstatic->id=$obj->propalid;
				$propalstatic->ref=$obj->ref;

				print '<table class="nobordernopadding"><tr class="nocellnopadd">';
				print '<td class="nobordernopadding" nowrap="nowrap">';
				print $propalstatic->getNomUrl(1);
				print '</td>';
				print '<td width="18" class="nobordernopadding" nowrap="nowrap">';
				if ($db->jdate($obj->dp) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
				print '</td>';
				print '<td width="16" align="center" class="nobordernopadding">';
				$filename=dol_sanitizeFileName($obj->ref);
				$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($obj->ref);
				$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
				$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
				print '</td></tr></table>';

				print "</td>";

				print '<td align="left"><a href="fiche.php?socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,44).'</a></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">'.$propalstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";