add_contract_do.php3

来自「FIREFLY 是一个多用户专业帮助桌面系统」· PHP3 代码 · 共 185 行

PHP3
185
字号
<?##################################################################  ADD CONTRACT DO#################################################################/* init */include ("../include/levels.php3");$access_level = $r_level["admin"];include ("../include/config.php3");/* process */  $list_option = SQL_LIST_OPTION($dbproc);    reset($list_option);    $headermore = "";    while ($content = each($list_option))        {        $full_name_option[$content[1]['opt_id']] = $content[1]['opt_lbl'];        $multi_option[$content[1]['opt_id']] = $content[1]['opt_multi'];        $a = "option_".$content[1]['opt_id'];        if ($$a)            {            $headermore .= "&$a=".$$a;            if ($$a == "on" )                $ctropt[$content[1]['opt_id']] = 1;            else                $ctropt[$content[1]['opt_id']] = $$a;            }        }  if ($ClearContract)    {    SQL_CLOSE($dbproc);    if ($mode == "edit")    header ("location:./display_contract.php3?ctr_id=$ctr_id");    else    header ("location:./add_contract_form.php3");    }  else if ($AddProduct)    {    if (!$delprdptf)        {        $products .= ",$ref_product";        $platforms .= ",$ref_platform";        }    else        {        list($dprd,$dptf) = explode(",",$delprdptf);        }    $list_product = explode (",",substr($products,1));    $list_platform = explode (",",substr($platforms,1));    while ($line = each($list_product))        $product_platform[$line[1].".".$list_platform[$line[0]]] = 1;    $products = "";    $platforms = "";    reset ($product_platform);    while ($line = each($product_platform))       {       list($prd,$ptf) = explode (".",$line[0]);       if ($prd != $dprd or $ptf != $dptf)            {            $products .= ",".$prd;            $platforms .= ",".$ptf;            }       }    $header = "location:./add_contract_form.php3?ctr_start_day=$ctr_start_day&ctr_start_month=$ctr_start_month&ctr_start_year=$ctr_start_year&ctr_sign_day=$ctr_sign_day&ctr_sign_month=$ctr_sign_month&ctr_sign_year=$ctr_sign_year&ctr_end_day=$ctr_end_day&ctr_end_month=$ctr_end_month&ctr_end_year=$ctr_end_year&ctr_ref=$ctr_ref&type_crt=$type_crt&cmp_id=$cmp_id&cmp_crt=".urlencode($cmp_crt)."&products=$products&platforms=$platforms&mode=$mode&ctr_id=$ctr_id";    SQL_CLOSE($dbproc);    header ($header.$headermore);    }  else    {      if ($mode != "edit")    $title= $msg_add_crt;      else    $title= $msg_modify_crt;      $renvoi = "add_contract_form.php3?ctr_start_day=$ctr_start_day&ctr_start_month=$ctr_start_month&ctr_start_year=$ctr_start_year&ctr_sign_day=$ctr_sign_day&ctr_sign_month=$ctr_sign_month&ctr_sign_year=$ctr_sign_year&ctr_end_day=$ctr_end_day&ctr_end_month=$ctr_end_month&ctr_end_year=$ctr_end_year&ctr_ref=$ctr_ref&type_crt=$type_crt&cmp_id=$cmp_id&cmp_crt=".urlencode($cmp_crt)."&products=$products&platforms=$platforms&mode=$mode&ctr_id=$ctr_id$headermore";$back = "<A HREF='./$renvoi' >Back</A>"; if ($mode != "edit" and (!$cmp_id or !$products or !$platforms or !$ctr_ref or !$AddContract))     {     SQL_CLOSE($dbproc);     header ("location:$renvoi");     } if ($mode == "edit" and (!$products or !$platforms or !$ctr_id or !$ModifyContract))     {     SQL_CLOSE($dbproc);     header ("location:$renvoi");     }//verification des dates$err_date_message = "";$sign_timestamp = mktime(0,0,0,$ctr_sign_day,$ctr_sign_month,$ctr_sign_year);$start_timestamp = mktime(0,0,0,$ctr_start_day,$ctr_start_month,$ctr_start_year);$end_timestamp = mktime(0,0,0,$ctr_end_day,$ctr_end_month,$ctr_end_year); if ($sign_timestamp > $end_timestamp)    $err_date_message .= "$msg_sign_sup_end<BR>"; if ($start_timestamp > $end_timestamp)    $err_date_message .= "$msg_start_sup_end<BR>"; if ($ctr_sign_year > 2037 or  $ctr_start_year > 2037 or $ctr_end_year > 2037)    $err_date_message .= "$msg_unix_date<BR>"; if ($err_date_message)    {      SQL_CLOSE($dbproc);      include "include/header.inc";      print "<h1>Error in dates</h1>";      print $err_date_message;      print $back;      include "include/footer.inc";      die();    }####################################//definition du contenu des contrats####################################//mise en forme des donn閑s$list_product = explode (",",substr($products,1));$list_platform = explode (",",substr($platforms,1));while ($line = each ($list_product))        $ctrprd[] = $line[1]."|".$list_platform[$line[0]];$datas['cdet_signdate'] =  SQL_TIME ($ctr_sign_day,$ctr_sign_month,$ctr_sign_year);$datas['cdet_startdate'] =  SQL_TIME ($ctr_start_day,$ctr_start_month,$ctr_start_year);$datas['cdet_enddate'] =  SQL_TIME ($ctr_end_day,$ctr_end_month,$ctr_end_year);if (!$ctropt)    settype ($ctropt,"array");$resultnum = SQL_CTR_REF_EXISTS($dbproc, $ctr_ref);if (is_array($resultnum) and $mode != "edit")    {    include "include/header.inc";    print "<b>$msg_ctr_exists_error :<b><br>";    print $msg_ctr_ref." : ".$resultnum["ctr_ref"].", ".$msg_sign_date." : ".$resultnum["cdet_signdate"].", ".$msg_cmp_crt." : ".$resultnum["cmp_name"]."<BR>";    print $back;    }else   {   if ($mode != "edit")        {        $datas['cmp_id'] = $cmp_id;        $datas['cdet_type'] = $type_crt;        }   else        $datas['ctr_id'] = $ctr_id;      $datas['ctr_ref'] = $ctr_ref;   $datas['ctrprd'] = $ctrprd;   $datas['ctropt'] = $ctropt;   $datas['ctr_status'] = 0;   $datas['user_id'] = $user->ent_id;   if ($mode != "edit")        $ctr_id = SQL_CTR_ALL_INSERT($dbproc, $datas);   else        $ctr_id = SQL_CTR_UPDATE($dbproc, $datas);   if ($ctr_id == -1)     {       include "include/header.inc";       print "$msg_sql_error<br>";       print $back;     }   else     {       SQL_CLOSE($dbproc);       header ("location:display_contract.php3?ctr_id=$ctr_id");     }   } include "include/footer.inc";  }?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?