/* Digikey export delimiter. */
define("CSV_DK_DELIM", "\t");
-define("QTY_COL_NAME", "Count");
+define("QTY_COL_NAME", "Quantity");
define("COMPANY_PN_COL_NAME", "P/N_LSI");
-define("DESIGNATOR_COL_NAME", "RefDes");
+define("DESIGNATOR_COL_NAME", "Designator");
+define("FOOTPRINT_COL_NAME", "Footprint");
define("ASSEMBLY_COL_NAME", "Asm");
define("DO_NOT_POPULATE_KEYWORD", "DNP");
"width" => 30),
COMPANY_PN_COL_NAME => array("nom" => "LSI P/N",
"width" => 15),
- "PatternName" => array("nom" => "Footprint",
- "width" => 20),
+ FOOTPRINT_COL_NAME => array("nom" => "Footprint",
+ "width" => 20),
ASSEMBLY_COL_NAME => array("nom" => "Assembly",
"width" => 0),
"UnitCost" => array("nom" => "Unit Cost",
/* Combinaison de plusieurs lignes en une seule pour PCAD. */
refdes_combine($data, $num, $col_num_to_id, $col_id_to_num);
+$voltage_present = false;
+
/* Génère une liste des colonnes pour le tri. */
foreach ($data as $key => $row) {
$sort_type[$key] = $row[$col_id_to_num['Type']];
$sort_desc[$key] = $row[$col_id_to_num['Description']];
$sort_val[$key] = $row[$col_id_to_num['Value']];
- $sort_volt[$key] = $row[$col_id_to_num['Voltage']];
+
+ if (isset($col_id_to_num['Voltage'])) {
+ $voltage_present = true;
+ $sort_volt[$key] = $row[$col_id_to_num['Voltage']];
+ }
}
/*
* Triage des lignes selon la référence (colonne DESIGNATOR_COL_NAME),
* et ensuite selon la description, la valeur et enfin le voltage.
*/
-array_multisort($sort_type, SORT_ASC, SORT_STRING,
- $sort_desc, SORT_ASC, SORT_STRING,
- $sort_val, SORT_ASC, SORT_NUMERIC,
- $sort_volt, SORT_ASC, SORT_NUMERIC,
- $data);
+if ($voltage_present) {
+ array_multisort($sort_type, SORT_ASC, SORT_STRING,
+ $sort_desc, SORT_ASC, SORT_STRING,
+ $sort_val, SORT_ASC, SORT_NUMERIC,
+ $sort_volt, SORT_ASC, SORT_NUMERIC,
+ $data);
+} else {
+ array_multisort($sort_type, SORT_ASC, SORT_STRING,
+ $sort_desc, SORT_ASC, SORT_STRING,
+ $sort_val, SORT_ASC, SORT_NUMERIC,
+ $data);
+}
if ($digikey_bom) {
/* Exportation BOM digikey. */